Upstream myusuf3/delorean state of the touched files before 4469a7f88d
This commit is contained in:
1 parent
ad3f7e7b5d
commit
c8e576472e
2 files changed
-18
No files matched your search
@@ -240,10 +240,6 @@ class Delorean(object):
|
|||||||
return self.epoch == other.epoch
|
return self.epoch == other.epoch
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __hash__(self):
|
|
||||||
# Hash on what __eq__ compares, so equal instants hash equal.
|
|
||||||
return hash(self.epoch)
|
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
return self.epoch < other.epoch
|
return self.epoch < other.epoch
|
||||||
|
|
||||||
|
|||||||
@@ -50,20 +50,6 @@ class DeloreanTests(unittest.TestCase):
|
|||||||
dt = date(2013, 5, 6)
|
dt = date(2013, 5, 6)
|
||||||
self.assertRaises(ValueError, delorean.Delorean, dt)
|
self.assertRaises(ValueError, delorean.Delorean, dt)
|
||||||
|
|
||||||
def test_hashable(self):
|
|
||||||
# Defining __eq__ without __hash__ makes instances unhashable in Python 3.
|
|
||||||
self.assertEqual(hash(self.do), hash(self.do))
|
|
||||||
self.assertIn(self.do, {self.do})
|
|
||||||
mapping = {self.do: "value"}
|
|
||||||
self.assertEqual(mapping[self.do], "value")
|
|
||||||
|
|
||||||
def test_hash_consistent_with_equality(self):
|
|
||||||
# Equal objects (same instant, different timezone) must hash equal.
|
|
||||||
other = self.do.shift("US/Pacific")
|
|
||||||
self.assertEqual(self.do, other)
|
|
||||||
self.assertEqual(hash(self.do), hash(other))
|
|
||||||
self.assertEqual(len({self.do, other}), 1)
|
|
||||||
|
|
||||||
def test_initialize_from_datetime_naive(self):
|
def test_initialize_from_datetime_naive(self):
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
delorean.DeloreanInvalidTimezone, delorean.Delorean, datetime=self.naive_dt
|
delorean.DeloreanInvalidTimezone, delorean.Delorean, datetime=self.naive_dt
|
||||||
|
|||||||
Reference in new issue
Block a user