#28926: some big values of DurationField are saved inaccurately on SQLite and 
MySQL
-------------------------------------+-------------------------------------
               Reporter:  Sergey     |          Owner:  nobody
  Fedoseev                           |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  1.8
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 {{{
 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)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28926>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.efcab45f1d9200225f0f5a7c8e759cc7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to