Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_datetime.py @ 41026:3cfdb80bc68e legacy-trunk
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 06 Mar 2007 15:50:01 +0000 |
| parents | e776c83a0c19 |
| children | baabef6c00d6 |
line wrap: on
line diff
--- a/Lib/test/test_datetime.py Tue Mar 06 15:41:38 2007 +0000 +++ b/Lib/test/test_datetime.py Tue Mar 06 15:50:01 2007 +0000 @@ -1425,6 +1425,15 @@ 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
