Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#12562 closed (fixed)

Test failure on Python 2.7 alpha 2

Reported by: Karen Tracey Owned by: Karen Tracey
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: no UI/UX: no

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 by Alex Gaynor, 14 years ago

Triage Stage: UnreviewedAccepted

Your solution LGTM.

comment:2 by Karen Tracey, 14 years ago

Owner: changed from nobody to Karen Tracey

I'll do that then.

comment:3 by Karen Tracey, 14 years ago

Resolution: fixed
Status: newclosed

(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 by Karen Tracey, 14 years ago

(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 by Jacob, 12 years ago

milestone: 1.2

Milestone 1.2 deleted

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