Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#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)

11993.diff (431 bytes ) - added by Krzysztof Klimonda 15 years ago.
add ValueError to list of caught exceptions

Download all attachments as: .zip

Change History (5)

comment:1 by Krzysztof Klimonda, 15 years ago

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.

by Krzysztof Klimonda, 15 years ago

Attachment: 11993.diff added

add ValueError to list of caught exceptions

comment:2 by Krzysztof Klimonda, 15 years ago

Has patch: set

comment:3 by Alex Gaynor, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in r11618.

comment:4 by anonymous, 15 years ago

Correction, fixed in r11619.

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