diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-09-18 14:21:14 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-09-18 14:21:14 +0200 |
commit | ec26f83f2ea13d7f15c461ac49d46dfcdf49b8ec (patch) | |
tree | 4e6c2a4ca830582b09e61df574c0935982ef058e /Lib/test | |
parent | 02d6a25beaa3922f487e984a852c2ef2127d0a7f (diff) | |
download | cpython-git-ec26f83f2ea13d7f15c461ac49d46dfcdf49b8ec.tar.gz |
Issue #25155: Fix _PyTime_Divide() rounding
_PyTime_Divide() rounding was wrong: copy code from Python default which has
now much better unit tests.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_time.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 6bcd2124fa..de0cbc4020 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -946,14 +946,14 @@ class TestPyTime_t(unittest.TestCase): # nanoseconds (1, 0, FLOOR), (1, 1, CEILING), - (-1, 0, FLOOR), - (-1, -1, CEILING), + (-1, -1, FLOOR), + (-1, 0, CEILING), # seconds + nanoseconds (1234 * MS_TO_NS + 1, 1234, FLOOR), (1234 * MS_TO_NS + 1, 1235, CEILING), - (-1234 * MS_TO_NS - 1, -1234, FLOOR), - (-1234 * MS_TO_NS - 1, -1235, CEILING), + (-1234 * MS_TO_NS - 1, -1235, FLOOR), + (-1234 * MS_TO_NS - 1, -1234, CEILING), ): with self.subTest(nanoseconds=ns, milliseconds=ms, round=rnd): self.assertEqual(PyTime_AsMilliseconds(ns, rnd), ms) @@ -983,14 +983,14 @@ class TestPyTime_t(unittest.TestCase): # nanoseconds (1, 0, FLOOR), (1, 1, CEILING), - (-1, 0, FLOOR), - (-1, -1, CEILING), + (-1, -1, FLOOR), + (-1, 0, CEILING), # seconds + nanoseconds (1234 * US_TO_NS + 1, 1234, FLOOR), (1234 * US_TO_NS + 1, 1235, CEILING), - (-1234 * US_TO_NS - 1, -1234, FLOOR), - (-1234 * US_TO_NS - 1, -1235, CEILING), + (-1234 * US_TO_NS - 1, -1235, FLOOR), + (-1234 * US_TO_NS - 1, -1234, CEILING), ): with self.subTest(nanoseconds=ns, milliseconds=ms, round=rnd): self.assertEqual(PyTime_AsMicroseconds(ns, rnd), ms) |