# -*- 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'' # PLAdministrativeUnitSelect ########################################################## >>> from django.contrib.localflavor.pl.forms import PLAdministrativeUnitSelect >>> f = PLAdministrativeUnitSelect() >>> f.render('administrativeunit','katowice') u'' # 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('43-34-234-323') u'43-34-234-323' >>> f.clean('433-344-24-23') u'433-344-24-23' # 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.'] """