mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Fixes #8860: Round half-microseconds to even in the timedelta constructor.
(Original patch by Mark Dickinson.)
This commit is contained in:
parent
5e5a8230c2
commit
790d269d39
4 changed files with 42 additions and 22 deletions
|
|
@ -619,6 +619,10 @@ class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase):
|
|||
eq(td(hours=-.2/us_per_hour), td(0))
|
||||
eq(td(days=-.4/us_per_day, hours=-.2/us_per_hour), td(microseconds=-1))
|
||||
|
||||
# Test for a patch in Issue 8860
|
||||
eq(td(microseconds=0.5), 0.5*td(microseconds=1.0))
|
||||
eq(td(microseconds=0.5)//td.resolution, 0.5*td.resolution//td.resolution)
|
||||
|
||||
def test_massive_normalization(self):
|
||||
td = timedelta(microseconds=-1)
|
||||
self.assertEqual((td.days, td.seconds, td.microseconds),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue