diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-09-21 16:30:56 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-09-21 16:30:56 (GMT) |
commit | 3e62f78c4ef51972258b8f6bf76cb725cabddcad (patch) | |
tree | 92b455da50cc66f8adaa1a2fd93477780aea39b6 /Lib/test/datetimetester.py | |
parent | b3bfc3d88b9693f9a21dfcee2530f889025f239d (diff) | |
download | cpython-3e62f78c4ef51972258b8f6bf76cb725cabddcad.zip cpython-3e62f78c4ef51972258b8f6bf76cb725cabddcad.tar.gz cpython-3e62f78c4ef51972258b8f6bf76cb725cabddcad.tar.bz2 |
Fixed microsecond rounding in python version of utcfromtimestamp
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r-- | Lib/test/datetimetester.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 7adf54c..0ee544b 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -1729,10 +1729,10 @@ class TestDateTime(TestDate): def test_microsecond_rounding(self): # Test whether fromtimestamp "rounds up" floats that are less # than 1/2 microsecond smaller than an integer. - self.assertEqual(self.theclass.fromtimestamp(0.9999999), - self.theclass.fromtimestamp(1)) - self.assertEqual(self.theclass.fromtimestamp(0.99999949).microsecond, - 999999) + for fts in [self.theclass.fromtimestamp, + self.theclass.utcfromtimestamp]: + self.assertEqual(fts(0.9999999), fts(1)) + self.assertEqual(fts(0.99999949).microsecond, 999999) def test_insane_fromtimestamp(self): # It's possible that some platform maps time_t to double, |