PageRenderTime 52ms CodeModel.GetById 48ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/regressiontests/forms/localflavor/za.py

https://code.google.com/p/mango-py/
Python | 29 lines | 25 code | 4 blank | 0 comment | 0 complexity | 81a36b2d278a5a118a8fc29574504f87 MD5 | raw file
 1from django.contrib.localflavor.za.forms import ZAIDField, ZAPostCodeField
 2
 3from utils import LocalFlavorTestCase
 4
 5
 6class ZALocalFlavorTests(LocalFlavorTestCase):
 7    def test_ZAIDField(self):
 8        error_invalid = [u'Enter a valid South African ID number']
 9        valid = {
10            '0002290001003': '0002290001003',
11            '000229 0001 003': '0002290001003',
12        }
13        invalid = {
14            '0102290001001': error_invalid,
15            '811208': error_invalid,
16            '0002290001004': error_invalid,
17        }
18        self.assertFieldOutput(ZAIDField, valid, invalid)
19
20    def test_ZAPostCodeField(self):
21        error_invalid = [u'Enter a valid South African postal code']
22        valid = {
23            '0000': '0000',
24        }
25        invalid = {
26            'abcd': error_invalid,
27            ' 7530': error_invalid,
28        }
29        self.assertFieldOutput(ZAPostCodeField, valid, invalid)