App Engine Python SDK version 1.7.4 (2)
[gae.git] / python / lib / django_1_4 / tests / regressiontests / localflavor / pt / tests.py
blob29aa1781eb36fa77cc244b3c699bf81d93632a79
1 from django.contrib.localflavor.pt.forms import PTZipCodeField, PTPhoneNumberField
3 from django.test import SimpleTestCase
6 class PTLocalFlavorTests(SimpleTestCase):
7 def test_PTZipCodeField(self):
8 error_format = [u'Enter a zip code in the format XXXX-XXX.']
9 valid = {
10 '3030-034': '3030-034',
11 '1003456': '1003-456',
13 invalid = {
14 '2A200': error_format,
15 '980001': error_format,
17 self.assertFieldOutput(PTZipCodeField, valid, invalid)
19 def test_PTPhoneNumberField(self):
20 error_format = [u'Phone numbers must have 9 digits, or start by + or 00.']
21 valid = {
22 '917845189': '917845189',
23 '91 784 5189': '917845189',
24 '+351 91 111': '+35191111',
25 '00351873': '00351873',
27 invalid = {
28 '91 784 51 8': error_format,
29 '091 456 987 1': error_format,
31 self.assertFieldOutput(PTPhoneNumberField, valid, invalid)