Code

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#11993 closed (fixed)

ValueError: Cannot convert NaN to integer in regressiontests.defaultfilters.tests using Python 2.6.3

Reported by: kklimonda 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: UI/UX:

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 kklimonda 5 years ago.
add ValueError to list of caught exceptions

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 years ago by kklimonda

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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.

Changed 5 years ago by kklimonda

add ValueError to list of caught exceptions

comment:2 Changed 5 years ago by kklimonda

  • Has patch set

comment:3 Changed 5 years ago by Alex

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

Fixed in r11618.

comment:4 Changed 5 years ago by anonymous

Correction, fixed in r11619.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.