# -*- 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('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.'] """