Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#12562 closed (fixed)

Test failure on Python 2.7 alpha 2

Reported by: kmtracey Owned by: kmtracey
Component: Uncategorized Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I get one (just one!) test failure running the test suite on Python 2.7 alpha 2:

======================================================================
FAIL: Doctest: regressiontests.fixtures_regress.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/kmt/django/trunk/django/test/_doctest.py", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for regressiontests.fixtures_regress.models.__test__.API_TESTS
  File "/home/kmt/django/trunk/tests/regressiontests/fixtures_regress/models.py", line unknown line number, in API_TESTS

----------------------------------------------------------------------
File "/home/kmt/django/trunk/tests/regressiontests/fixtures_regress/models.py", line ?, in regressiontests.fixtures_regress.models.__test__.API_TESTS
Failed example:
    management.call_command('dumpdata', 'fixtures_regress.animal', format='json')
Expected:
    [{"pk": 1, "model": "fixtures_regress.animal", "fields": {"count": 3, "weight": 1.2, "name": "Lion", "latin_name": "Panthera leo"}}, {"pk": 2, "model": "fixtures_regress.animal", "fields": {"count": 2, "weight": 2.29..., "name": "Platypus", "latin_name": "Ornithorhynchus anatinus"}}, {"pk": 10, "model": "fixtures_regress.animal", "fields": {"count": 42, "weight": 1.2, "name": "Emu", "latin_name": "Dromaius novaehollandiae"}}]
Got:
    [{"pk": 1, "model": "fixtures_regress.animal", "fields": {"count": 3, "weight": 1.2, "name": "Lion", "latin_name": "Panthera leo"}}, {"pk": 2, "model": "fixtures_regress.animal", "fields": {"count": 2, "weight": 2.3, "name": "Platypus", "latin_name": "Ornithorhynchus anatinus"}}, {"pk": 10, "model": "fixtures_regress.animal", "fields": {"count": 42, "weight": 1.2, "name": "Emu", "latin_name": "Dromaius novaehollandiae"}}]


----------------------------------------------------------------------
Ran 1242 tests in 902.979s

FAILED (failures=1)

The only difference is in the weight of the Platypus. We're expecting 2.29something but now getting 2.3. As the Platypus is actually added with a weight of 2.3, I think the change is due to improved string/float rounding in this version of Python (noted as one of the 3.1 changes backported to 2.7 here: http://docs.python.org/dev/whatsnew/2.7.html#python-3-1-features). I think we can fix this by simply changing the weight here to be one that won't exhibit this anomalous behavior between different Python versions?

Change History (5)

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Your solution LGTM.

comment:2 Changed 5 years ago by kmtracey

  • Owner changed from nobody to kmtracey

I'll do that then.

comment:3 Changed 5 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from new to closed

(In [12132]) Fixed #12562: Made Platypus just a tad lighter so it does not trigger noticing version-dependent differences in Ptyhon string/float conversions.

comment:4 Changed 5 years ago by kmtracey

(In [12134]) [1.1.X] Fixed #12562: Made Platypus just a tad lighter so it does not trigger noticing version-dependent differences in Ptyhon string/float conversions.

r12132 from trunk.

comment:5 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top