diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-09-20 20:42:34 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-09-20 20:42:34 (GMT) |
commit | 9b9ed867bc86232434e700153353b49e323ec02e (patch) | |
tree | 5b61008d4d8728e72ddd70e321e288c87d9f9709 /Lib | |
parent | 7c6c80d89f60c9b28cfb08d32c61108b16b2461a (diff) | |
parent | 3ec153681e4e5553fc6882699beb5af6d45c75e6 (diff) | |
download | cpython-9b9ed867bc86232434e700153353b49e323ec02e.zip cpython-9b9ed867bc86232434e700153353b49e323ec02e.tar.gz cpython-9b9ed867bc86232434e700153353b49e323ec02e.tar.bz2 |
merged 3.2
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/datetime.py | 2 | ||||
-rw-r--r-- | Lib/test/datetimetester.py | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/Lib/datetime.py b/Lib/datetime.py index a15c6b0..f506e9a 100644 --- a/Lib/datetime.py +++ b/Lib/datetime.py @@ -1854,6 +1854,8 @@ class timezone(tzinfo): return (self._offset, self._name) def __eq__(self, other): + if type(other) != timezone: + return False return self._offset == other._offset def __hash__(self): diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index a417170..931ef6f 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -235,6 +235,8 @@ class TestTimeZone(unittest.TestCase): self.assertEqual(timezone(-5 * HOUR), timezone(-5 * HOUR, 'EST')) with self.assertRaises(TypeError): timezone(ZERO) < timezone(ZERO) self.assertIn(timezone(ZERO), {timezone(ZERO)}) + self.assertTrue(timezone(ZERO) != None) + self.assertFalse(timezone(ZERO) == None) def test_aware_datetime(self): # test that timezone instances can be used by datetime |