diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-06-16 00:19:47 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-06-16 00:19:47 (GMT) |
commit | 0831382d69890eeab58f43588887058a52a1f4b5 (patch) | |
tree | f749634dbfbc248dec21b74d676f28c3b23a605e /Lib/test/datetimetester.py | |
parent | ea0b8239401123fa7f41c74f6fc9ded1cf74088a (diff) | |
download | cpython-0831382d69890eeab58f43588887058a52a1f4b5.zip cpython-0831382d69890eeab58f43588887058a52a1f4b5.tar.gz cpython-0831382d69890eeab58f43588887058a52a1f4b5.tar.bz2 |
Issue #15006: Allow equality comparison between naive and aware time
or datetime objects.
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r-- | Lib/test/datetimetester.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index a4180ae..048d63c 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -2544,7 +2544,7 @@ class TestTimeTZ(TestTime, TZInfoBase, unittest.TestCase): self.assertEqual(t1, t2) self.assertEqual(t1, t3) self.assertEqual(t2, t3) - self.assertRaises(TypeError, lambda: t4 == t5) # mixed tz-aware & naive + self.assertNotEqual(t4, t5) # mixed tz-aware & naive self.assertRaises(TypeError, lambda: t4 < t5) # mixed tz-aware & naive self.assertRaises(TypeError, lambda: t5 < t4) # mixed tz-aware & naive @@ -2696,7 +2696,7 @@ class TestTimeTZ(TestTime, TZInfoBase, unittest.TestCase): t2 = t2.replace(tzinfo=FixedOffset(None, "")) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(0, "")) - self.assertRaises(TypeError, lambda: t1 == t2) + self.assertNotEqual(t1, t2) # In time w/ identical tzinfo objects, utcoffset is ignored. class Varies(tzinfo): @@ -2801,16 +2801,16 @@ class TestDateTimeTZ(TestDateTime, TZInfoBase, unittest.TestCase): microsecond=1) self.assertTrue(t1 > t2) - # Make t2 naive and it should fail. + # Make t2 naive and it should differ. t2 = self.theclass.min - self.assertRaises(TypeError, lambda: t1 == t2) + self.assertNotEqual(t1, t2) self.assertEqual(t2, t2) # It's also naive if it has tzinfo but tzinfo.utcoffset() is None. class Naive(tzinfo): def utcoffset(self, dt): return None t2 = self.theclass(5, 6, 7, tzinfo=Naive()) - self.assertRaises(TypeError, lambda: t1 == t2) + self.assertNotEqual(t1, t2) self.assertEqual(t2, t2) # OTOH, it's OK to compare two of these mixing the two ways of being @@ -3327,7 +3327,7 @@ class TestDateTimeTZ(TestDateTime, TZInfoBase, unittest.TestCase): t2 = t2.replace(tzinfo=FixedOffset(None, "")) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(0, "")) - self.assertRaises(TypeError, lambda: t1 == t2) + self.assertNotEqual(t1, t2) # In datetime w/ identical tzinfo objects, utcoffset is ignored. class Varies(tzinfo): |