mirror of
https://github.com/python/cpython.git
synced 2025-09-11 11:17:16 +00:00
Bug #1478429: make datetime.datetime.fromtimestamp accept every float,
possibly "rounding up" to the next whole second.
This commit is contained in:
parent
6a907d8b8e
commit
6d78a582ec
2 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue