#11993 closed (fixed)
ValueError: Cannot convert NaN to integer in regressiontests.defaultfilters.tests using Python 2.6.3
| Reported by: | Krzysztof Klimonda | Owned by: | nobody |
|---|---|---|---|
| Component: | Uncategorized | Version: | 1.1 |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Automatic rebuild of Django 1.1 on Ubuntu 9.10 has shown that the following regression test fails on Python 2.6.3:
======================================================================
FAIL: Doctest: regressiontests.defaultfilters.tests
----------------------------------------------------------------------
Traceback (most recent call last):
File "/build/buildd/python-django-1.1/django/test/_doctest.py", line 2180, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for regressiontests.defaultfilters.tests
File "/build/buildd/python-django-1.1/tests/regressiontests/defaultfilters/tests.py", line 2, in tests
----------------------------------------------------------------------
File "/build/buildd/python-django-1.1/tests/regressiontests/defaultfilters/tests.py", line 53, in regressiontests.defaultfilters.tests
Failed example:
floatformat(nan) == unicode(nan)
Exception raised:
Traceback (most recent call last):
File "/build/buildd/python-django-1.1/django/test/_doctest.py", line 1267, in __run
compileflags, 1) in test.globs
File "<doctest regressiontests.defaultfilters.tests[26]>", line 1, in <module>
floatformat(nan) == unicode(nan)
File "/build/buildd/python-django-1.1/django/template/defaultfilters.py", line 164, in floatformat
m = int(d) - d
File "/usr/lib/python2.6/decimal.py", line 1515, in __int__
raise ValueError("Cannot convert NaN to integer")
ValueError: Cannot convert NaN to integer
----------------------------------------------------------------------
Ran 859 tests in 408.553s
FAILED (failures=1)
The same happens with the current trunk version.
Attachments (1)
Note:
See TracTickets
for help on using tickets.
It's probably because of this bug and the way it was fixed in Python 2.6.3: http://bugs.python.org/issue6795, catching ValueError makes test pass.