# -*- coding: utf-8 -*- # Tests for the contrib/localflavor/ DE form fields. tests = r""" # DEZipCodeField ############################################################## >>> from django.contrib.localflavor.de.forms import DEZipCodeField >>> f = DEZipCodeField() >>> f.clean('99423') u'99423' >>> f.clean(' 99423') Traceback (most recent call last): ... ValidationError: [u'Enter a zip code in the format XXXXX.'] # DEStateSelect ############################################################# >>> from django.contrib.localflavor.de.forms import DEStateSelect >>> w = DEStateSelect() >>> w.render('states', 'TH') u'' # DEIdentityCardNumberField ################################################# >>> from django.contrib.localflavor.de.forms import DEIdentityCardNumberField >>> f = DEIdentityCardNumberField() >>> f.clean('7549313035D-6004103-0903042-0') u'7549313035D-6004103-0903042-0' >>> f.clean('9786324830D 6104243 0910271 2') u'9786324830D-6104243-0910271-2' >>> f.clean('0434657485D-6407276-0508137-9') Traceback (most recent call last): ... ValidationError: [u'Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.'] """