django/tests/regressiontests/forms/localflavor/pl.py

82 lines
22 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
# Tests for the contrib/localflavor/ PL form fields.
tests = r"""
# PLVoivodeshipSelect ##########################################################
>>> from django.contrib.localflavor.pl.forms import PLVoivodeshipSelect
>>> f = PLVoivodeshipSelect()
>>> f.render('voivodeships','pomerania')
u'<select name="voivodeships">\n<option value="lower_silesia">Lower Silesia</option>\n<option value="kuyavia-pomerania">Kuyavia-Pomerania</option>\n<option value="lublin">Lublin</option>\n<option value="lubusz">Lubusz</option>\n<option value="lodz">Lodz</option>\n<option value="lesser_poland">Lesser Poland</option>\n<option value="masovia">Masovia</option>\n<option value="opole">Opole</option>\n<option value="subcarpatia">Subcarpatia</option>\n<option value="podlasie">Podlasie</option>\n<option value="pomerania" selected="selected">Pomerania</option>\n<option value="silesia">Silesia</option>\n<option value="swietokrzyskie">Swietokrzyskie</option>\n<option value="warmia-masuria">Warmia-Masuria</option>\n<option value="greater_poland">Greater Poland</option>\n<option value="west_pomerania">West Pomerania</option>\n</select>'
# PLAdministrativeUnitSelect ##########################################################
>>> from django.contrib.localflavor.pl.forms import PLAdministrativeUnitSelect
>>> f = PLAdministrativeUnitSelect()
>>> f.render('administrativeunit','katowice')
u'<select name="administrativeunit">\n<option value="wroclaw">Wroc\u0142aw</option>\n<option value="jeleniagora">Jelenia G\xf3ra</option>\n<option value="legnica">Legnica</option>\n<option value="boleslawiecki">boles\u0142awiecki</option>\n<option value="dzierzoniowski">dzier\u017coniowski</option>\n<option value="glogowski">g\u0142ogowski</option>\n<option value="gorowski">g\xf3rowski</option>\n<option value="jaworski">jaworski</option>\n<option value="jeleniogorski">jeleniog\xf3rski</option>\n<option value="kamiennogorski">kamiennog\xf3rski</option>\n<option value="klodzki">k\u0142odzki</option>\n<option value="legnicki">legnicki</option>\n<option value="lubanski">luba\u0144ski</option>\n<option value="lubinski">lubi\u0144ski</option>\n<option value="lwowecki">lw\xf3wecki</option>\n<option value="milicki">milicki</option>\n<option value="olesnicki">ole\u015bnicki</option>\n<option value="olawski">o\u0142awski</option>\n<option value="polkowicki">polkowicki</option>\n<option value="strzelinski">strzeli\u0144ski</option>\n<option value="sredzki">\u015bredzki</option>\n<option value="swidnicki">\u015bwidnicki</option>\n<option value="trzebnicki">trzebnicki</option>\n<option value="walbrzyski">wa\u0142brzyski</option>\n<option value="wolowski">wo\u0142owski</option>\n<option value="wroclawski">wroc\u0142awski</option>\n<option value="zabkowicki">z\u0105bkowicki</option>\n<option value="zgorzelecki">zgorzelecki</option>\n<option value="zlotoryjski">z\u0142otoryjski</option>\n<option value="bydgoszcz">Bydgoszcz</option>\n<option value="torun">Toru\u0144</option>\n<option value="wloclawek">W\u0142oc\u0142awek</option>\n<option value="grudziadz">Grudzi\u0105dz</option>\n<option value="aleksandrowski">aleksandrowski</option>\n<option value="brodnicki">brodnicki</option>\n<option value="bydgoski">bydgoski</option>\n<option value="chelminski">che\u0142mi\u0144ski</option>\n<option value="golubsko-dobrzynski">golubsko-dobrzy\u0144ski</option>\n<option value="grudziadzki">grudzi\u0105dzki</option>\n<option value="inowroclawski">inowroc\u0142awski</option>\n<option value="lipnowski">lipnowski</option>\n<option value="mogilenski">mogile\u0144ski</option>\n<option value="nakielski">nakielski</option>\n<option value="radziejowski">radziejowski</option>\n<option value="rypinski">rypi\u0144ski</option>\n<option value="sepolenski">s\u0119pole\u0144ski</option>\n<option value="swiecki">\u015bwiecki</option>\n<option value="torunski">toru\u0144ski</option>\n<option value="tucholski">tucholski</option>\n<option value="wabrzeski">w\u0105brzeski</option>\n<option value="wloclawski">wroc\u0142awski</option>\n<option value="zninski">\u017ani\u0144ski</option>\n<option value="lublin">Lublin</option>\n<option value="biala-podlaska">Bia\u0142a Podlaska</option>\n<option value="chelm">Che\u0142m</option>\n<option value="zamosc">Zamo\u015b\u0107</option>\n<option value="bialski">bialski</option>\n<option value="bilgorajski">bi\u0142gorajski</option>\n<option value="chelmski">che\u0142mski</option>\n<option value="hrubieszowski">hrubieszowski</option>\n<option value="janowski">janowski</option>\n<option value="krasnostawski">krasnostawski</option>\n<option value="krasnicki">kra\u015bnicki</option>\n<option value="lubartowski">lubartowski</option>\n<option value="lubelski">lubelski</option>\n<option value="leczynski">\u0142\u0119czy\u0144ski</option>\n<option value="lukowski">\u0142ukowski</option>\n<option value="opolski">opolski</option>\n<option value="parczewski">parczewski</option>\n<option value="pulawski">pu\u0142awski</option>\n<option value="radzynski">radzy\u0144ski</option>\n<option value="rycki">rycki</option>\n<option value="swidnicki">\u015bwidnicki</option>\n<option value="tomaszowski">tomaszowski</option>\n<option value="wlodawski">w\u0142odawski</option>\n<option value="zamojski">zamojski</option>\n<option value="gorzow-wielkopolski">Gorz\xf3w Wielkopolski</option>\n<option value="zielona-gora">Zielona G\xf3ra</option>\n<option value="gorzowski">gorzowski</option>\n<option value="krosnienski">kro\u015bnie\u0144ski</option>\n<option va
# PLPostalCodeField ##############################################################
>>> from django.contrib.localflavor.pl.forms import PLPostalCodeField
>>> f = PLPostalCodeField()
>>> f.clean('43--434')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XX-XXX.']
>>> f.clean('41-403')
u'41-403'
# PLTaxNumberField ###############################################################
>>> from django.contrib.localflavor.pl.forms import PLTaxNumberField
>>> f = PLTaxNumberField()
>>> f.clean('43-343-234-323')
Traceback (most recent call last):
...
ValidationError: [u'Enter a tax number field (NIP) in the format XXX-XXX-XX-XX or XX-XX-XXX-XXX.']
>>> f.clean('64-62-414-124')
u'6462414124'
>>> f.clean('646-241-41-24')
u'6462414124'
>>> f.clean('646-241-41-23')
Traceback (most recent call last):
...
ValidationError: [u'Wrong checksum for the Tax Number (NIP).']
# PLNationalIdentificationNumberField ############################################
>>> from django.contrib.localflavor.pl.forms import PLNationalIdentificationNumberField
>>> f = PLNationalIdentificationNumberField()
>>> f.clean('80071610614')
u'80071610614'
>>> f.clean('80071610610')
Traceback (most recent call last):
...
ValidationError: [u'Wrong checksum for the National Identification Number.']
>>> f.clean('80')
Traceback (most recent call last):
...
ValidationError: [u'National Identification Number consists of 11 digits.']
>>> f.clean('800716106AA')
Traceback (most recent call last):
...
ValidationError: [u'National Identification Number consists of 11 digits.']
# PLNationalBusinessRegisterField ################################################
>>> from django.contrib.localflavor.pl.forms import PLNationalBusinessRegisterField
>>> f = PLNationalBusinessRegisterField()
>>> f.clean('590096454')
u'590096454'
>>> f.clean('590096453')
Traceback (most recent call last):
...
ValidationError: [u'Wrong checksum for the National Business Register Number (REGON).']
>>> f.clean('590096')
Traceback (most recent call last):
...
ValidationError: [u'National Business Register Number (REGON) consists of 7 or 9 digits.']
"""