summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_datetime.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-03-06 15:50:01 (GMT)
committerGuido van Rossum <guido@python.org>2007-03-06 15:50:01 (GMT)
commit2054ee9b6f268d16e90e4ff30186b5a4a1f91719 (patch)
tree031cec2752a201c6f5b4d4139781f6f7dc38394c /Lib/test/test_datetime.py
parentd1287323ca3273f4408a5c3f3047c316b72ea78c (diff)
downloadcpython-2054ee9b6f268d16e90e4ff30186b5a4a1f91719.zip
cpython-2054ee9b6f268d16e90e4ff30186b5a4a1f91719.tar.gz
cpython-2054ee9b6f268d16e90e4ff30186b5a4a1f91719.tar.bz2
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest. Somebody please backport to 2.5.
Diffstat (limited to 'Lib/test/test_datetime.py')
-rw-r--r--Lib/test/test_datetime.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index 3aa0468..b0341a4 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