Ticket #3866: it_localflavor_tests.diff

File it_localflavor_tests.diff, 1.8 KB (added by flavio.curella@…, 8 years ago)

tests for it localflavor

  • tests/regressiontests/forms/tests.py

     
    38783878<option value="okinawa">Okinawa</option>
    38793879</select>
    38803880
     3881# ITZipCodeField #############################################################
     3882
     3883>>> from django.contrib.localflavor.it.forms import ITZipCodeField
     3884>>> f = ITZipCodeField()
     3885>>> f.clean('00100')
     3886u'00100'
     3887>>> f.clean(' 00100')
     3888Traceback (most recent call last):
     3889...
     3890ValidationError: [u'Enter a zip code in the format XXXXX.']
     3891
     3892# ITRegionSelect #############################################################
     3893
     3894>>> from django.contrib.localflavor.it.forms import ITRegionSelect
     3895>>> w = ITRegionSelect()
     3896>>> w.render('regions', 'PMN')
     3897u'<select name="regions">\n<option value="ABR">Abruzzo</option>\n<option value="BAS">Basilicata</option>\n<option value="CAL">Calabria</option>\n<option value="CAM">Campania</option>\n<option value="EMR">Emilia-Romagna</option>\n<option value="FVG">Friuli-Venezia Giulia</option>\n<option value="LAZ">Lazio</option>\n<option value="LIG">Liguria</option>\n<option value="LOM">Lombardia</option>\n<option value="MAR">Marche</option>\n<option value="MOL">Molise</option>\n<option value="PMN" selected="selected">Piemonte</option>\n<option value="PUG">Puglia</option>\n<option value="SAR">Sardegna</option>\n<option value="SIC">Sicilia</option>\n<option value="TOS">Toscana</option>\n<option value="TAA">Trentino-Alto Adige</option>\n<option value="UMB">Umbria</option>\n<option value="VAO">Valle d\u2019Aosta</option>\n<option value="VEN">Veneto</option>\n</select>'
     3898
    38813899# FIZipCodeField #############################################################
    38823900
    38833901FIZipCodeField validates that the data is a valid FI zipcode.
Back to Top