diff -r 5ff1fc726848 -r c6bca38c1cbf parts/django/tests/regressiontests/forms/localflavor/nl.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/parts/django/tests/regressiontests/forms/localflavor/nl.py Sat Jan 08 11:20:57 2011 +0530 @@ -0,0 +1,62 @@ +from django.contrib.localflavor.nl.forms import (NLPhoneNumberField, + NLZipCodeField, NLSoFiNumberField, NLProvinceSelect) + +from utils import LocalFlavorTestCase + + +class NLLocalFlavorTests(LocalFlavorTestCase): + def test_NLProvinceSelect(self): + f = NLProvinceSelect() + out = u'''''' + self.assertEqual(f.render('provinces', 'OV'), out) + + def test_NLPhoneNumberField(self): + error_invalid = [u'Enter a valid phone number'] + valid = { + '012-3456789': '012-3456789', + '0123456789': '0123456789', + '+31-12-3456789': '+31-12-3456789', + '(0123) 456789': '(0123) 456789', + } + invalid = { + 'foo': error_invalid, + } + self.assertFieldOutput(NLPhoneNumberField, valid, invalid) + + def test_NLZipCodeField(self): + error_invalid = [u'Enter a valid postal code'] + valid = { + '1234ab': '1234 AB', + '1234 ab': '1234 AB', + '1234 AB': '1234 AB', + } + invalid = { + '0123AB': error_invalid, + 'foo': error_invalid, + } + self.assertFieldOutput(NLZipCodeField, valid, invalid) + + def test_NLSoFiNumberField(self): + error_invalid = [u'Enter a valid SoFi number'] + valid = { + '123456782': '123456782', + } + invalid = { + '000000000': error_invalid, + '123456789': error_invalid, + 'foo': error_invalid, + } + self.assertFieldOutput(NLSoFiNumberField, valid, invalid)