class TestSaveLoad(TestCase):
def test_simple_roundtrip(self):
duration = datetime.timedelta(microseconds=674999999999999999)
DurationModel.objects.create(field=duration)
loaded = DurationModel.objects.get()
self.assertEqual(loaded.field, duration)
======================================================================
FAIL: test_simple_roundtrip (model_fields.test_durationfield.TestSaveLoad)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
yield
File "/usr/lib/python3.6/unittest/case.py", line 605, in run
testMethod()
File "/home/sergey/dev/django/tests/model_fields/test_durationfield.py", line 18, in test_simple_roundtrip
self.assertEqual(loaded.field, duration)
File "/usr/lib/python3.6/unittest/case.py", line 829, in assertEqual
assertion_func(first, second, msg=msg)
File "/usr/lib/python3.6/unittest/case.py", line 822, in _baseAssertEqual
raise self.failureException(msg)
AssertionError: datetime.timedelta(7812500) != datetime.timedelta(7812499, 86399, 999999)
PR