PageRenderTime 24ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/regressiontests/forms/localflavor/il.py

https://code.google.com/p/mango-py/
Python | 39 lines | 35 code | 4 blank | 0 comment | 0 complexity | b9b79dfae38629ac264479d27054f190 MD5 | raw file
 1from django.contrib.localflavor.il.forms import (ILPostalCodeField,
 2    ILIDNumberField)
 3
 4from utils import LocalFlavorTestCase
 5
 6
 7class ILLocalFlavorTests(LocalFlavorTestCase):
 8    def test_ILPostalCodeField(self):
 9        error_format = [u'Enter a postal code in the format XXXXX']
10        valid = {
11            '69973': '69973',
12            '699 73': '69973',
13            '12345': '12345',
14        }
15        invalid = {
16            '84545x': error_format,
17            '123456': error_format,
18            '1234': error_format,
19            '123 4': error_format,
20        }
21        self.assertFieldOutput(ILPostalCodeField, valid, invalid)
22
23    def test_ILIDNumberField(self):
24        error_invalid = [u'Enter a valid ID number.']
25        valid = {
26            '3933742-3': '39337423',
27            '39337423': '39337423',
28            '039337423': '039337423',
29            '03933742-3': '039337423',
30            '0091': '0091',
31        }
32        invalid = {
33            '123456789': error_invalid,
34            '12345678-9': error_invalid,
35            '012346578': error_invalid,
36            '012346578-': error_invalid,
37            '0001': error_invalid,
38        }
39        self.assertFieldOutput(ILIDNumberField, valid, invalid)