from django.contrib.localflavor.de.forms import (DEZipCodeField, DEStateSelect, DEIdentityCardNumberField) from utils import LocalFlavorTestCase class DELocalFlavorTests(LocalFlavorTestCase): def test_DEStateSelect(self): f = DEStateSelect() out = u'''''' self.assertEqual(f.render('states', 'TH'), out) def test_DEZipCodeField(self): error_format = [u'Enter a zip code in the format XXXXX.'] valid = { '99423': '99423', } invalid = { ' 99423': error_format, } self.assertFieldOutput(DEZipCodeField, valid, invalid) def test_DEIdentityCardNumberField(self): error_format = [u'Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.'] valid = { '7549313035D-6004103-0903042-0': '7549313035D-6004103-0903042-0', '9786324830D 6104243 0910271 2': '9786324830D-6104243-0910271-2', } invalid = { '0434657485D-6407276-0508137-9': error_format, } self.assertFieldOutput(DEIdentityCardNumberField, valid, invalid)