Django

Code

Show
Ignore:
Timestamp:
11/07/08 19:44:46 (2 months ago)
Author:
kmtracey
Message:

Fixed #5748 -- Made floatformat filter round properly on all platforms and handle NaN input correctly on Windows. Also added tests for these cases. Thanks for the report and initial patch to SmileyChris? and PJCrosier.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/defaultfilters/tests.py

    r8599 r9369  
    1414>>> floatformat(0.0) 
    1515u'0' 
    16 >>> floatformat(7.7,3) 
     16>>> floatformat(7.7, 3) 
    1717u'7.700' 
    18 >>> floatformat(6.000000,3) 
     18>>> floatformat(6.000000, 3) 
    1919u'6.000' 
    2020>>> floatformat(6.200000, 3) 
     
    2222>>> floatformat(6.200000, -3) 
    2323u'6.200' 
    24 >>> floatformat(13.1031,-3) 
     24>>> floatformat(13.1031, -3) 
    2525u'13.103' 
    2626>>> floatformat(11.1197, -2) 
     
    3636>>> floatformat(13.1031, u'bar') 
    3737u'13.1031' 
     38>>> floatformat(18.125, 2)  
     39u'18.13'  
    3840>>> floatformat(u'foo', u'bar') 
    3941u'' 
     42>>> floatformat(u'¿Cómo esta usted?') 
     43u'' 
    4044>>> floatformat(None) 
    4145u'' 
     46>>> pos_inf = float(1e30000) 
     47>>> floatformat(pos_inf) == unicode(pos_inf) 
     48True 
     49>>> neg_inf = float(-1e30000) 
     50>>> floatformat(neg_inf) == unicode(neg_inf) 
     51True 
     52>>> nan = pos_inf / pos_inf 
     53>>> floatformat(nan) == unicode(nan) 
     54True 
    4255 
    4356>>> addslashes(u'"double quotes" and \'single quotes\'')