diff options
author | Georg Brandl <georg@python.org> | 2006-04-28 19:09:24 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-04-28 19:09:24 (GMT) |
commit | 6d78a582ec2e24d3ec4d449b0960613b17c602e2 (patch) | |
tree | 14198ca21f249d0ec91702504a326831d451ed20 /Lib/test/test_datetime.py | |
parent | 6a907d8b8ef4ebe86730386f2c1ff788bc8b945f (diff) | |
download | cpython-6d78a582ec2e24d3ec4d449b0960613b17c602e2.zip cpython-6d78a582ec2e24d3ec4d449b0960613b17c602e2.tar.gz cpython-6d78a582ec2e24d3ec4d449b0960613b17c602e2.tar.bz2 |
Bug #1478429: make datetime.datetime.fromtimestamp accept every float,
possibly "rounding up" to the next whole second.
Diffstat (limited to 'Lib/test/test_datetime.py')
-rw-r--r-- | Lib/test/test_datetime.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py index 2528b4a..203bea1 100644 --- a/Lib/test/test_datetime.py +++ b/Lib/test/test_datetime.py @@ -1400,6 +1400,12 @@ class TestDateTime(TestDate): got = self.theclass.utcfromtimestamp(ts) self.verify_field_equality(expected, got) + def test_microsecond_rounding(self): + # Test whether fromtimestamp "rounds up" floats that are less + # than one microsecond smaller than an integer. + self.assertEquals(self.theclass.fromtimestamp(0.9999999), + self.theclass.fromtimestamp(1)) + def test_insane_fromtimestamp(self): # It's possible that some platform maps time_t to double, # and that this test will fail there. This test should |