summaryrefslogtreecommitdiff
path: root/Lib/test/datetimetester.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-09-09 01:02:23 +0200
committerVictor Stinner <victor.stinner@gmail.com>2015-09-09 01:02:23 +0200
commit7667f58151d5efbbae4f0b1d7178f99dad0d74c0 (patch)
tree99928f745f6377adbf42d8892f30ec1de75a2559 /Lib/test/datetimetester.py
parent69cc487df42d9064a74551ae26a8c115dade3e3a (diff)
downloadcpython-git-7667f58151d5efbbae4f0b1d7178f99dad0d74c0.tar.gz
Issue #23517: fromtimestamp() and utcfromtimestamp() methods of
datetime.datetime now round microseconds to nearest with ties going to nearest even integer (ROUND_HALF_EVEN), as round(float), instead of rounding towards -Infinity (ROUND_FLOOR). pytime API: replace _PyTime_ROUND_HALF_UP with _PyTime_ROUND_HALF_EVEN. Fix also _PyTime_Divide() for negative numbers. _PyTime_AsTimeval_impl() now reuses _PyTime_Divide() instead of reimplementing rounding modes.
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r--Lib/test/datetimetester.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index d87b106cff..467fbe2f45 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -1874,7 +1874,7 @@ class TestDateTime(TestDate):
self.assertEqual(t, zero)
t = fts(-1/2**7)
self.assertEqual(t.second, 59)
- self.assertEqual(t.microsecond, 992187)
+ self.assertEqual(t.microsecond, 992188)
t = fts(1e-7)
self.assertEqual(t, zero)
@@ -1888,7 +1888,7 @@ class TestDateTime(TestDate):
self.assertEqual(t.microsecond, 0)
t = fts(1/2**7)
self.assertEqual(t.second, 0)
- self.assertEqual(t.microsecond, 7813)
+ self.assertEqual(t.microsecond, 7812)
def test_insane_fromtimestamp(self):
# It's possible that some platform maps time_t to double,