from django.contrib.localflavor.fr.forms import (FRZipCodeField, FRPhoneNumberField, FRDepartmentSelect) from django.test import SimpleTestCase class FRLocalFlavorTests(SimpleTestCase): def test_FRZipCodeField(self): error_format = [u'Enter a zip code in the format XXXXX.'] valid = { '75001': '75001', '93200': '93200', } invalid = { '2A200': error_format, '980001': error_format, } self.assertFieldOutput(FRZipCodeField, valid, invalid) def test_FRPhoneNumberField(self): error_format = [u'Phone numbers must be in 0X XX XX XX XX format.'] valid = { '01 55 44 58 64': '01 55 44 58 64', '0155445864': '01 55 44 58 64', '01 5544 5864': '01 55 44 58 64', '01 55.44.58.64': '01 55 44 58 64', '01.55.44.58.64': '01 55 44 58 64', } invalid = { '01,55,44,58,64': error_format, '555 015 544': error_format, } self.assertFieldOutput(FRPhoneNumberField, valid, invalid) def test_FRDepartmentSelect(self): f = FRDepartmentSelect() out = u'''''' self.assertHTMLEqual(f.render('dep', 'Paris'), out)