Django

Code

Ticket #6513: 6513_w_tests.diff

File 6513_w_tests.diff, 1.0 kB (added by PhiR, 9 months ago)

added regression tests

  • django/template/defaultfilters.py

    old new  
    124124        d = int(arg) 
    125125    except ValueError: 
    126126        return force_unicode(f) 
    127     m = f - int(f) 
     127    try: 
     128        m = f - int(f) 
     129    except OverflowError: 
     130        return force_unicode(f) 
    128131    if not m and d < 0: 
    129132        return mark_safe(u'%d' % int(f)) 
    130133    else: 
  • tests/regressiontests/defaultfilters/tests.py

    old new  
    3939u'' 
    4040>>> floatformat(None) 
    4141u'' 
     42>>> floatformat(float('infinity')) 
     43u'inf' 
     44>>> floatformat(float('nan')) 
     45u'nan' 
    4246 
    4347>>> addslashes(u'"double quotes" and \'single quotes\'') 
    4448u'\\"double quotes\\" and \\\'single quotes\\\''