App Engine Python SDK version 1.7.4 (2)
[gae.git] / python / lib / django_1_4 / tests / regressiontests / localflavor / gb / tests.py
blobb32162d36533c03068b630eaa874dea036919902
1 from django.contrib.localflavor.gb.forms import GBPostcodeField
3 from django.test import SimpleTestCase
6 class GBLocalFlavorTests(SimpleTestCase):
7 def test_GBPostcodeField(self):
8 error_invalid = [u'Enter a valid postcode.']
9 valid = {
10 'BT32 4PX': 'BT32 4PX',
11 'GIR 0AA': 'GIR 0AA',
12 'BT324PX': 'BT32 4PX',
13 ' so11aa ': 'SO1 1AA',
14 ' so1 1aa ': 'SO1 1AA',
15 'G2 3wt': 'G2 3WT',
16 'EC1A 1BB': 'EC1A 1BB',
17 'Ec1a1BB': 'EC1A 1BB',
19 invalid = {
20 '1NV 4L1D': error_invalid,
21 '1NV4L1D': error_invalid,
22 ' b0gUS': error_invalid,
24 self.assertFieldOutput(GBPostcodeField, valid, invalid)
25 valid = {}
26 invalid = {
27 '1NV 4L1D': [u'Enter a bloody postcode!'],
29 kwargs = {'error_messages': {'invalid': 'Enter a bloody postcode!'}}
30 self.assertFieldOutput(GBPostcodeField, valid, invalid, field_kwargs=kwargs)