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.']
10 '3030-034': '3030-034',
11 '1003456': '1003-456',
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.']
22 '917845189': '917845189',
23 '91 784 5189': '917845189',
24 '+351 91 111': '+35191111',
25 '00351873': '00351873',
28 '91 784 51 8': error_format
,
29 '091 456 987 1': error_format
,
31 self
.assertFieldOutput(PTPhoneNumberField
, valid
, invalid
)