diff options
author | Georg Brandl <georg@python.org> | 2007-03-06 17:46:17 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-03-06 17:46:17 +0000 |
commit | 02d7cffb8f0454e605401c05574b53321346fa46 (patch) | |
tree | 02728432ac475a5cff357ea18f8eaad789ca3fb8 /Lib/test/test_datetime.py | |
parent | 1a74b4325cdfac112bf0d4df8559f87ad3cb9f1a (diff) | |
download | cpython-git-02d7cffb8f0454e605401c05574b53321346fa46.tar.gz |
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
(backport from rev. 54167 by Guido)
Diffstat (limited to 'Lib/test/test_datetime.py')
-rw-r--r-- | Lib/test/test_datetime.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py index 436cfcad75..f2f3a87478 100644 --- a/Lib/test/test_datetime.py +++ b/Lib/test/test_datetime.py @@ -1425,6 +1425,15 @@ class TestDateTime(TestDate): self.assertRaises(ValueError, self.theclass.utcfromtimestamp, insane) + def test_negative_float_fromtimestamp(self): + # The result is tz-dependent; at least test that this doesn't + # fail (like it did before bug 1646728 was fixed). + self.theclass.fromtimestamp(-1.05) + + def test_negative_float_utcfromtimestamp(self): + d = self.theclass.utcfromtimestamp(-1.05) + self.assertEquals(d, self.theclass(1969, 12, 31, 23, 59, 58, 950000)) + def test_utcnow(self): import time |