diff --git a/tests/regressiontests/forms/localflavor/__init__.py b/tests/regressiontests/forms/localflavor/__init__.py
deleted file mode 100644
index 792d600548..0000000000
--- a/tests/regressiontests/forms/localflavor/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-#
diff --git a/tests/regressiontests/forms/localflavor/au.py b/tests/regressiontests/forms/localflavor/au.py
deleted file mode 100644
index 9a753d85e2..0000000000
--- a/tests/regressiontests/forms/localflavor/au.py
+++ /dev/null
@@ -1,50 +0,0 @@
-from django.contrib.localflavor.au.forms import (AUPostCodeField,
- AUPhoneNumberField, AUStateSelect)
-
-from django.test import SimpleTestCase
-
-
-class AULocalFlavorTests(SimpleTestCase):
- def test_AUStateSelect(self):
- f = AUStateSelect()
- out = u'''
-Australian Capital Territory
-New South Wales
-Northern Territory
-Queensland
-South Australia
-Tasmania
-Victoria
-Western Australia
- '''
- self.assertEqual(f.render('state', 'NSW'), out)
-
- def test_AUPostCodeField(self):
- error_format = [u'Enter a 4 digit postcode.']
- valid = {
- '1234': '1234',
- '2000': '2000',
- }
- invalid = {
- 'abcd': error_format,
- '20001': [u'Ensure this value has at most 4 characters (it has 5).'] + error_format,
- }
- self.assertFieldOutput(AUPostCodeField, valid, invalid)
-
- def test_AUPhoneNumberField(self):
- error_format = [u'Phone numbers must contain 10 digits.']
- valid = {
- '1234567890': '1234567890',
- '0213456789': '0213456789',
- '02 13 45 67 89': '0213456789',
- '(02) 1345 6789': '0213456789',
- '(02) 1345-6789': '0213456789',
- '(02)1345-6789': '0213456789',
- '0408 123 456': '0408123456',
- }
- invalid = {
- '123': error_format,
- '1800DJANGO': error_format,
- }
- self.assertFieldOutput(AUPhoneNumberField, valid, invalid)
-
diff --git a/tests/regressiontests/forms/localflavor/mk.py b/tests/regressiontests/forms/localflavor/mk.py
deleted file mode 100644
index 913dfb777d..0000000000
--- a/tests/regressiontests/forms/localflavor/mk.py
+++ /dev/null
@@ -1,131 +0,0 @@
-from django.contrib.localflavor.mk.forms import (
- MKIdentityCardNumberField, MKMunicipalitySelect, UMCNField)
-
-from django.test import SimpleTestCase
-
-
-class MKLocalFlavorTests(SimpleTestCase):
-
- def test_MKIdentityCardNumberField(self):
- error_invalid = [u'Identity card numbers must contain either 4 to 7 '
- 'digits or an uppercase letter and 7 digits.']
- valid = {
- 'L0018077':'L0018077',
- 'A0078315' : 'A0078315',
- }
- invalid = {
- '123': error_invalid,
- 'abcdf': error_invalid,
- '234390a': error_invalid,
- }
- self.assertFieldOutput(MKIdentityCardNumberField, valid, invalid)
-
- def test_MKMunicipalitySelect(self):
- f = MKMunicipalitySelect()
- out=u'''
-Aerodrom
-Ara\u010dinovo
-Berovo
-Bitola
-Bogdanci
-Bogovinje
-Bosilovo
-Brvenica
-Butel
-Valandovo
-Vasilevo
-Vev\u010dani
-Veles
-Vinica
-Vrane\u0161tica
-Vrap\u010di\u0161te
-Gazi Baba
-Gevgelija
-Gostivar
-Gradsko
-Debar
-Debarca
-Del\u010devo
-Demir Kapija
-Demir Hisar
-Dolneni
-Drugovo
-Gjor\u010de Petrov
-\u017delino
-Zajas
-Zelenikovo
-Zrnovci
-Ilinden
-Jegunovce
-Kavadarci
-Karbinci
-Karpo\u0161
-Kisela Voda
-Ki\u010devo
-Kon\u010de
-Ko\u0107ani
-Kratovo
-Kriva Palanka
-Krivoga\u0161tani
-Kru\u0161evo
-Kumanovo
-Lipkovo
-Lozovo
-Mavrovo i Rostu\u0161a
-Makedonska Kamenica
-Makedonski Brod
-Mogila
-Negotino
-Novaci
-Novo Selo
-Oslomej
-Ohrid
-Petrovec
-Peh\u010devo
-Plasnica
-Prilep
-Probi\u0161tip
-Radovi\u0161
-Rankovce
-Resen
-Rosoman
-Saraj
-Sveti Nikole
-Sopi\u0161te
-Star Dojran
-Staro Nagori\u010dane
-Struga
-Strumica
-Studeni\u010dani
-Tearce
-Tetovo
-Centar
-Centar-\u017dupa
-\u010cair
-\u010ca\u0161ka
-\u010ce\u0161inovo-Oble\u0161evo
-\u010cu\u010der-Sandevo
-\u0160tip
-\u0160uto Orizari
- '''
- self.assertEqual(f.render('municipality', 'DL' ), out)
-
- def test_UMCNField(self):
- error_invalid = [u'This field should contain exactly 13 digits.']
- error_checksum = [u'The UMCN is not valid.']
- error_date = [u'The first 7 digits of the UMCN '
- 'must represent a valid past date.']
- valid = {
- '2402983450006': '2402983450006',
- '2803984430038': '2803984430038',
- '1909982045004': '1909982045004',
- }
- invalid = {
- '240298345': error_invalid,
- 'abcdefghj': error_invalid,
- '2402082450006': error_date,
- '3002982450006': error_date,
- '2402983450007': error_checksum,
- '2402982450006': error_checksum,
- }
- self.assertFieldOutput(UMCNField, valid, invalid)
diff --git a/tests/regressiontests/forms/localflavor/mx.py b/tests/regressiontests/forms/localflavor/mx.py
deleted file mode 100644
index 30937de665..0000000000
--- a/tests/regressiontests/forms/localflavor/mx.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# -*- coding: utf-8 -*-
-from django.contrib.localflavor.mx.forms import (MXZipCodeField, MXRFCField,
- MXStateSelect, MXCURPField)
-
-from django.test import SimpleTestCase
-
-
-class MXLocalFlavorTests(SimpleTestCase):
- def test_MXStateSelect(self):
- f = MXStateSelect()
- out = u'''
-Aguascalientes
-Baja California
-Baja California Sur
-Campeche
-Chihuahua
-Chiapas
-Coahuila
-Colima
-Distrito Federal
-Durango
-Guerrero
-Guanajuato
-Hidalgo
-Jalisco
-Estado de México
-Michoacán
-Morelos
-Nayarit
-Nuevo León
-Oaxaca
-Puebla
-Querétaro
-Quintana Roo
-Sinaloa
-San Luis Potosí
-Sonora
-Tabasco
-Tamaulipas
-Tlaxcala
-Veracruz
-Yucatán
-Zacatecas
- '''
- self.assertEqual(f.render('state', 'MIC'), out)
-
- def test_MXZipCodeField(self):
- error_format = [u'Enter a valid zip code in the format XXXXX.']
- valid = {
- '58120': u'58120',
- '58502': u'58502',
- '59310': u'59310',
- '99999': u'99999',
- }
- invalid = {
- '17000': error_format,
- '18000': error_format,
- '19000': error_format,
- '00000': error_format,
- }
- self.assertFieldOutput(MXZipCodeField, valid, invalid)
-
- def test_MXRFCField(self):
- error_format = [u'Enter a valid RFC.']
- error_checksum = [u'Invalid checksum for RFC.']
- valid = {
- 'MoFN641205eX5': u'MOFN641205EX5',
- 'ICa060120873': u'ICA060120873',
- 'eUcG751104rT0': u'EUCG751104RT0',
- 'GME08100195A': u'GME08100195A',
- 'AA&060524KX5': u'AA&060524KX5',
- 'CAÑ0708045P7': u'CAÑ0708045P7',
- 'aaa000101aa9': u'AAA000101AA9',
- }
- invalid = {
- 'MED0000000XA': error_format,
- '0000000000XA': error_format,
- 'AAA000000AA6': error_format,
- # Dates
- 'XXX880002XXX': error_format,
- 'XXX880200XXX': error_format,
- 'XXX880132XXX': error_format,
- 'XXX880230XXX': error_format,
- 'XXX880431XXX': error_format,
- # Incorrect checksum
- 'MOGR650524E73': error_checksum,
- 'HVA7810058F1': error_checksum,
- 'MoFN641205eX2': error_checksum,
- 'ICa060120871': error_checksum,
- 'eUcG751104rT7': error_checksum,
- 'GME081001955': error_checksum,
- 'AA&060524KX9': error_checksum,
- 'CAÑ0708045P2': error_checksum,
- }
- self.assertFieldOutput(MXRFCField, valid, invalid)
-
- def test_MXCURPField(self):
- error_format = [u'Enter a valid CURP.']
- error_checksum = [u'Invalid checksum for CURP.']
- valid = {
- 'AaMG890608HDFLJL00': u'AAMG890608HDFLJL00',
- 'BAAd890419HMNRRV07': u'BAAD890419HMNRRV07',
- 'VIAA900930MMNClL08': u'VIAA900930MMNCLL08',
- 'HEGR891009HMNRRD09': u'HEGR891009HMNRRD09',
- 'MARR890512HMNRMN09': u'MARR890512HMNRMN09',
- 'MESJ890928HMNZNS00': u'MESJ890928HMNZNS00',
- 'BAAA890317HDFRLL03': u'BAAA890317HDFRLL03',
- 'TOMA880125HMNRRNO2': u'TOMA880125HMNRRNO2',
- 'OOMG890727HMNRSR06': u'OOMG890727HMNRSR06',
- 'AAAA000101HDFCCC09': u'AAAA000101HDFCCC09',
- }
- invalid = {
- 'AAAA000000HDFCCC09': error_format,
- 'AAAA000000HDFAAA03': error_format,
- 'AAAA000000HXXCCC08': error_format,
- 'AAAA000000XMNCCC02': error_format,
- 'HEGR891009HMNRRD0A': error_format,
- 'MARR890512HMNRMN0A': error_format,
- 'AaMG890608HDFLJL01': error_checksum,
- 'BAAd890419HMNRRV08': error_checksum,
- 'VIAA900930MMNClL09': error_checksum,
- 'MESJ890928HMNZNS01': error_checksum,
- 'BAAA890317HDFRLL04': error_checksum,
- 'TOMA880125HMNRRNO3': error_checksum,
- 'OOMG890727HMNRSR07': error_checksum,
- }
- self.assertFieldOutput(MXCURPField, valid, invalid)
diff --git a/tests/regressiontests/forms/localflavor/us.py b/tests/regressiontests/forms/localflavor/us.py
deleted file mode 100644
index 9b38db5b7c..0000000000
--- a/tests/regressiontests/forms/localflavor/us.py
+++ /dev/null
@@ -1,129 +0,0 @@
-from django.contrib.localflavor.us.forms import (USZipCodeField,
- USPhoneNumberField, USStateField, USStateSelect, USSocialSecurityNumberField)
-
-from django.test import SimpleTestCase
-
-
-class USLocalFlavorTests(SimpleTestCase):
- def test_USStateSelect(self):
- f = USStateSelect()
- out = u'''
-Alabama
-Alaska
-American Samoa
-Arizona
-Arkansas
-Armed Forces Americas
-Armed Forces Europe
-Armed Forces Pacific
-California
-Colorado
-Connecticut
-Delaware
-District of Columbia
-Florida
-Georgia
-Guam
-Hawaii
-Idaho
-Illinois
-Indiana
-Iowa
-Kansas
-Kentucky
-Louisiana
-Maine
-Maryland
-Massachusetts
-Michigan
-Minnesota
-Mississippi
-Missouri
-Montana
-Nebraska
-Nevada
-New Hampshire
-New Jersey
-New Mexico
-New York
-North Carolina
-North Dakota
-Northern Mariana Islands
-Ohio
-Oklahoma
-Oregon
-Pennsylvania
-Puerto Rico
-Rhode Island
-South Carolina
-South Dakota
-Tennessee
-Texas
-Utah
-Vermont
-Virgin Islands
-Virginia
-Washington
-West Virginia
-Wisconsin
-Wyoming
- '''
- self.assertEqual(f.render('state', 'IL'), out)
-
- def test_USZipCodeField(self):
- error_format = [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
- valid = {
- '60606': '60606',
- 60606: '60606',
- '04000': '04000',
- '60606-1234': '60606-1234',
- }
- invalid = {
- '4000': error_format,
- '6060-1234': error_format,
- '60606-': error_format,
- }
- self.assertFieldOutput(USZipCodeField, valid, invalid)
-
- def test_USPhoneNumberField(self):
- error_format = [u'Phone numbers must be in XXX-XXX-XXXX format.']
- valid = {
- '312-555-1212': '312-555-1212',
- '3125551212': '312-555-1212',
- '312 555-1212': '312-555-1212',
- '(312) 555-1212': '312-555-1212',
- '312 555 1212': '312-555-1212',
- '312.555.1212': '312-555-1212',
- '312.555-1212': '312-555-1212',
- ' (312) 555.1212 ': '312-555-1212',
- }
- invalid = {
- '555-1212': error_format,
- '312-55-1212': error_format,
- }
- self.assertFieldOutput(USPhoneNumberField, valid, invalid)
-
- def test_USStateField(self):
- error_invalid = [u'Enter a U.S. state or territory.']
- valid = {
- 'il': 'IL',
- 'IL': 'IL',
- 'illinois': 'IL',
- ' illinois ': 'IL',
- }
- invalid = {
- 60606: error_invalid,
- }
- self.assertFieldOutput(USStateField, valid, invalid)
-
- def test_USSocialSecurityNumberField(self):
- error_invalid = [u'Enter a valid U.S. Social Security number in XXX-XX-XXXX format.']
-
- valid = {
- '987-65-4330': '987-65-4330',
- '987654330': '987-65-4330',
- }
- invalid = {
- '078-05-1120': error_invalid,
- }
- self.assertFieldOutput(USSocialSecurityNumberField, valid, invalid)
diff --git a/tests/regressiontests/forms/localflavortests.py b/tests/regressiontests/forms/localflavortests.py
deleted file mode 100644
index 6a3fb2322e..0000000000
--- a/tests/regressiontests/forms/localflavortests.py
+++ /dev/null
@@ -1,42 +0,0 @@
-from localflavor.ar import ARLocalFlavorTests
-from localflavor.at import ATLocalFlavorTests
-from localflavor.au import AULocalFlavorTests
-from localflavor.be import BELocalFlavorTests
-from localflavor.br import BRLocalFlavorTests
-from localflavor.ca import CALocalFlavorTests
-from localflavor.ch import CHLocalFlavorTests
-from localflavor.cl import CLLocalFlavorTests
-from localflavor.cz import CZLocalFlavorTests
-from localflavor.cn import CNLocalFlavorTests
-from localflavor.co import COLocalFlavorTests
-from localflavor.de import DELocalFlavorTests
-from localflavor.es import ESLocalFlavorTests
-from localflavor.ec import ECLocalFlavorTests
-from localflavor.fi import FILocalFlavorTests
-from localflavor.fr import FRLocalFlavorTests
-from localflavor.gb import GBLocalFlavorTests
-from localflavor.generic import GenericLocalFlavorTests
-from localflavor.hr import HRLocalFlavorTests
-from localflavor.id import IDLocalFlavorTests
-from localflavor.ie import IELocalFlavorTests
-from localflavor.il import ILLocalFlavorTests
-from localflavor.is_ import ISLocalFlavorTests
-from localflavor.in_ import INLocalFlavorTests
-from localflavor.it import ITLocalFlavorTests
-from localflavor.jp import JPLocalFlavorTests
-from localflavor.kw import KWLocalFlavorTests
-from localflavor.mk import MKLocalFlavorTests
-from localflavor.mx import MXLocalFlavorTests
-from localflavor.nl import NLLocalFlavorTests
-from localflavor.pl import PLLocalFlavorTests
-from localflavor.pt import PTLocalFlavorTests
-from localflavor.py import PYLocalFlavorTests
-from localflavor.ro import ROLocalFlavorTests
-from localflavor.ru import RULocalFlavorTests
-from localflavor.se import SELocalFlavorTests
-from localflavor.sk import SKLocalFlavorTests
-from localflavor.tr import TRLocalFlavorTests
-from localflavor.us import USLocalFlavorTests
-from localflavor.uy import UYLocalFlavorTests
-from localflavor.za import ZALocalFlavorTests
-
diff --git a/tests/regressiontests/forms/tests/__init__.py b/tests/regressiontests/forms/tests/__init__.py
index 9570835aa9..1b615c4583 100644
--- a/tests/regressiontests/forms/tests/__init__.py
+++ b/tests/regressiontests/forms/tests/__init__.py
@@ -10,47 +10,3 @@ from regressions import *
from util import *
from validators import TestFieldWithValidators
from widgets import *
-
-from regressiontests.forms.localflavortests import (
- ARLocalFlavorTests,
- ATLocalFlavorTests,
- AULocalFlavorTests,
- BELocalFlavorTests,
- BRLocalFlavorTests,
- CALocalFlavorTests,
- CHLocalFlavorTests,
- CLLocalFlavorTests,
- CNLocalFlavorTests,
- COLocalFlavorTests,
- CZLocalFlavorTests,
- DELocalFlavorTests,
- ECLocalFlavorTests,
- ESLocalFlavorTests,
- FILocalFlavorTests,
- FRLocalFlavorTests,
- GBLocalFlavorTests,
- GenericLocalFlavorTests,
- HRLocalFlavorTests,
- IDLocalFlavorTests,
- IELocalFlavorTests,
- ILLocalFlavorTests,
- ISLocalFlavorTests,
- INLocalFlavorTests,
- ITLocalFlavorTests,
- JPLocalFlavorTests,
- KWLocalFlavorTests,
- MKLocalFlavorTests,
- MXLocalFlavorTests,
- NLLocalFlavorTests,
- PLLocalFlavorTests,
- PTLocalFlavorTests,
- PYLocalFlavorTests,
- ROLocalFlavorTests,
- RULocalFlavorTests,
- SELocalFlavorTests,
- SKLocalFlavorTests,
- TRLocalFlavorTests,
- USLocalFlavorTests,
- UYLocalFlavorTests,
- ZALocalFlavorTests,
-)
diff --git a/tests/regressiontests/localflavor/ar/__init__.py b/tests/regressiontests/localflavor/ar/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/ar.py b/tests/regressiontests/localflavor/ar/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/ar.py
rename to tests/regressiontests/localflavor/ar/tests.py
diff --git a/tests/regressiontests/localflavor/at/__init__.py b/tests/regressiontests/localflavor/at/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/at.py b/tests/regressiontests/localflavor/at/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/at.py
rename to tests/regressiontests/localflavor/at/tests.py
diff --git a/tests/regressiontests/localflavor/au/tests.py b/tests/regressiontests/localflavor/au/tests.py
index 1f462d579f..bdfaa2b799 100644
--- a/tests/regressiontests/localflavor/au/tests.py
+++ b/tests/regressiontests/localflavor/au/tests.py
@@ -1,6 +1,9 @@
import re
-from django.test import TestCase
+from django.test import SimpleTestCase
+from django.contrib.localflavor.au.forms import (AUPostCodeField,
+ AUPhoneNumberField, AUStateSelect)
+
from forms import AustralianPlaceForm
SELECTED_OPTION_PATTERN = r''
@@ -8,7 +11,8 @@ BLANK_OPTION_PATTERN = r' '
INPUT_VALUE_PATTERN = r' ]*value="%s"[^>]*>'
-class AULocalflavorTests(TestCase):
+class AULocalflavorTests(SimpleTestCase):
+
def setUp(self):
self.form = AustralianPlaceForm(
{'state':'WA',
@@ -56,3 +60,46 @@ class AULocalflavorTests(TestCase):
str(self.form['postcode'])))
self.assertTrue(re.search(INPUT_VALUE_PATTERN % '4321',
str(self.form['postcode_required'])))
+
+ def test_AUStateSelect(self):
+ f = AUStateSelect()
+ out = u'''
+Australian Capital Territory
+New South Wales
+Northern Territory
+Queensland
+South Australia
+Tasmania
+Victoria
+Western Australia
+ '''
+ self.assertEqual(f.render('state', 'NSW'), out)
+
+ def test_AUPostCodeField(self):
+ error_format = [u'Enter a 4 digit postcode.']
+ valid = {
+ '1234': '1234',
+ '2000': '2000',
+ }
+ invalid = {
+ 'abcd': error_format,
+ '20001': [u'Ensure this value has at most 4 characters (it has 5).'] + error_format,
+ }
+ self.assertFieldOutput(AUPostCodeField, valid, invalid)
+
+ def test_AUPhoneNumberField(self):
+ error_format = [u'Phone numbers must contain 10 digits.']
+ valid = {
+ '1234567890': '1234567890',
+ '0213456789': '0213456789',
+ '02 13 45 67 89': '0213456789',
+ '(02) 1345 6789': '0213456789',
+ '(02) 1345-6789': '0213456789',
+ '(02)1345-6789': '0213456789',
+ '0408 123 456': '0408123456',
+ }
+ invalid = {
+ '123': error_format,
+ '1800DJANGO': error_format,
+ }
+ self.assertFieldOutput(AUPhoneNumberField, valid, invalid)
diff --git a/tests/regressiontests/localflavor/be/__init__.py b/tests/regressiontests/localflavor/be/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/be.py b/tests/regressiontests/localflavor/be/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/be.py
rename to tests/regressiontests/localflavor/be/tests.py
diff --git a/tests/regressiontests/localflavor/br/__init__.py b/tests/regressiontests/localflavor/br/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/br.py b/tests/regressiontests/localflavor/br/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/br.py
rename to tests/regressiontests/localflavor/br/tests.py
diff --git a/tests/regressiontests/localflavor/ca/__init__.py b/tests/regressiontests/localflavor/ca/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/ca.py b/tests/regressiontests/localflavor/ca/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/ca.py
rename to tests/regressiontests/localflavor/ca/tests.py
diff --git a/tests/regressiontests/localflavor/ch/__init__.py b/tests/regressiontests/localflavor/ch/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/ch.py b/tests/regressiontests/localflavor/ch/tests.py
similarity index 99%
rename from tests/regressiontests/forms/localflavor/ch.py
rename to tests/regressiontests/localflavor/ch/tests.py
index a2603666c3..5c939e1d7e 100644
--- a/tests/regressiontests/forms/localflavor/ch.py
+++ b/tests/regressiontests/localflavor/ch/tests.py
@@ -36,7 +36,7 @@ class CHLocalFlavorTests(SimpleTestCase):
Zurich
'''
self.assertEqual(f.render('state', 'AG'), out)
-
+
def test_CHZipCodeField(self):
error_format = [u'Enter a zip code in the format XXXX.']
valid = {
@@ -48,7 +48,7 @@ class CHLocalFlavorTests(SimpleTestCase):
'80 00': error_format,
}
self.assertFieldOutput(CHZipCodeField, valid, invalid)
-
+
def test_CHPhoneNumberField(self):
error_format = [u'Phone numbers must be in 0XX XXX XX XX format.']
valid = {
@@ -60,7 +60,7 @@ class CHLocalFlavorTests(SimpleTestCase):
'1234567890': error_format,
}
self.assertFieldOutput(CHPhoneNumberField, valid, invalid)
-
+
def test_CHIdentityCardNumberField(self):
error_format = [u'Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.']
valid = {
@@ -72,4 +72,3 @@ class CHLocalFlavorTests(SimpleTestCase):
'2123456701': error_format,
}
self.assertFieldOutput(CHIdentityCardNumberField, valid, invalid)
-
diff --git a/tests/regressiontests/localflavor/cl/__init__.py b/tests/regressiontests/localflavor/cl/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/cl.py b/tests/regressiontests/localflavor/cl/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/cl.py
rename to tests/regressiontests/localflavor/cl/tests.py
diff --git a/tests/regressiontests/localflavor/cn/__init__.py b/tests/regressiontests/localflavor/cn/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/cn.py b/tests/regressiontests/localflavor/cn/tests.py
similarity index 99%
rename from tests/regressiontests/forms/localflavor/cn.py
rename to tests/regressiontests/localflavor/cn/tests.py
index dccba9c862..8b91e66daf 100644
--- a/tests/regressiontests/forms/localflavor/cn.py
+++ b/tests/regressiontests/localflavor/cn/tests.py
@@ -110,4 +110,3 @@ class CNLocalFlavorTests(SimpleTestCase):
'14012345678': error_format
}
self.assertFieldOutput(CNCellNumberField, valid, invalid)
-
diff --git a/tests/regressiontests/localflavor/co/__init__.py b/tests/regressiontests/localflavor/co/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/co.py b/tests/regressiontests/localflavor/co/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/co.py
rename to tests/regressiontests/localflavor/co/tests.py
diff --git a/tests/regressiontests/localflavor/cz/__init__.py b/tests/regressiontests/localflavor/cz/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/cz.py b/tests/regressiontests/localflavor/cz/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/cz.py
rename to tests/regressiontests/localflavor/cz/tests.py
diff --git a/tests/regressiontests/localflavor/de/__init__.py b/tests/regressiontests/localflavor/de/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/de.py b/tests/regressiontests/localflavor/de/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/de.py
rename to tests/regressiontests/localflavor/de/tests.py
diff --git a/tests/regressiontests/localflavor/ec/__init__.py b/tests/regressiontests/localflavor/ec/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/ec.py b/tests/regressiontests/localflavor/ec/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/ec.py
rename to tests/regressiontests/localflavor/ec/tests.py
diff --git a/tests/regressiontests/localflavor/es/__init__.py b/tests/regressiontests/localflavor/es/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/es.py b/tests/regressiontests/localflavor/es/tests.py
similarity index 99%
rename from tests/regressiontests/forms/localflavor/es.py
rename to tests/regressiontests/localflavor/es/tests.py
index 513c6e21a4..ccd08b168d 100644
--- a/tests/regressiontests/forms/localflavor/es.py
+++ b/tests/regressiontests/localflavor/es/tests.py
@@ -153,7 +153,7 @@ class ESLocalFlavorTests(SimpleTestCase):
'78699688-2': error_invalid,
}
self.assertFieldOutput(ESIdentityCardNumberField, valid, invalid)
-
+
def test_ESCCCField(self):
error_invalid = [u'Please enter a valid bank account number in format XXXX-XXXX-XX-XXXXXXXXXX.']
error_checksum = [u'Invalid checksum for bank account number.']
@@ -169,5 +169,3 @@ class ESLocalFlavorTests(SimpleTestCase):
'2077-03-3879-3100254321': error_invalid,
}
self.assertFieldOutput(ESCCCField, valid, invalid)
-
-
diff --git a/tests/regressiontests/localflavor/fi/__init__.py b/tests/regressiontests/localflavor/fi/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/fi.py b/tests/regressiontests/localflavor/fi/tests.py
similarity index 99%
rename from tests/regressiontests/forms/localflavor/fi.py
rename to tests/regressiontests/localflavor/fi/tests.py
index e664e30af6..74a6ed2d9d 100644
--- a/tests/regressiontests/forms/localflavor/fi.py
+++ b/tests/regressiontests/localflavor/fi/tests.py
@@ -379,4 +379,3 @@ class FILocalFlavorTests(SimpleTestCase):
'101010b0101': error_invalid,
}
self.assertFieldOutput(FISocialSecurityNumber, valid, invalid)
-
diff --git a/tests/regressiontests/localflavor/fr/__init__.py b/tests/regressiontests/localflavor/fr/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/fr.py b/tests/regressiontests/localflavor/fr/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/fr.py
rename to tests/regressiontests/localflavor/fr/tests.py
diff --git a/tests/regressiontests/localflavor/gb/__init__.py b/tests/regressiontests/localflavor/gb/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/gb.py b/tests/regressiontests/localflavor/gb/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/gb.py
rename to tests/regressiontests/localflavor/gb/tests.py
diff --git a/tests/regressiontests/localflavor/generic/__init__.py b/tests/regressiontests/localflavor/generic/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/generic.py b/tests/regressiontests/localflavor/generic/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/generic.py
rename to tests/regressiontests/localflavor/generic/tests.py
diff --git a/tests/regressiontests/localflavor/hr/__init__.py b/tests/regressiontests/localflavor/hr/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/hr.py b/tests/regressiontests/localflavor/hr/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/hr.py
rename to tests/regressiontests/localflavor/hr/tests.py
diff --git a/tests/regressiontests/localflavor/id/__init__.py b/tests/regressiontests/localflavor/id/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/id.py b/tests/regressiontests/localflavor/id/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/id.py
rename to tests/regressiontests/localflavor/id/tests.py
diff --git a/tests/regressiontests/localflavor/ie/__init__.py b/tests/regressiontests/localflavor/ie/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/ie.py b/tests/regressiontests/localflavor/ie/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/ie.py
rename to tests/regressiontests/localflavor/ie/tests.py
diff --git a/tests/regressiontests/localflavor/il/__init__.py b/tests/regressiontests/localflavor/il/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/il.py b/tests/regressiontests/localflavor/il/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/il.py
rename to tests/regressiontests/localflavor/il/tests.py
diff --git a/tests/regressiontests/localflavor/in_/__init__.py b/tests/regressiontests/localflavor/in_/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/in_.py b/tests/regressiontests/localflavor/in_/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/in_.py
rename to tests/regressiontests/localflavor/in_/tests.py
diff --git a/tests/regressiontests/localflavor/is_/__init__.py b/tests/regressiontests/localflavor/is_/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/is_.py b/tests/regressiontests/localflavor/is_/tests.py
similarity index 99%
rename from tests/regressiontests/forms/localflavor/is_.py
rename to tests/regressiontests/localflavor/is_/tests.py
index c28750fab2..a252734feb 100644
--- a/tests/regressiontests/forms/localflavor/is_.py
+++ b/tests/regressiontests/localflavor/is_/tests.py
@@ -157,7 +157,7 @@ class ISLocalFlavorTests(SimpleTestCase):
902 Vestmannaeyjar
'''
self.assertEqual(f.render('foo', 'bar'), out)
-
+
def test_ISIdNumberField(self):
error_atleast = [u'Ensure this value has at least 10 characters (it has 9).']
error_invalid = [u'Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.']
@@ -174,10 +174,10 @@ class ISLocalFlavorTests(SimpleTestCase):
'230880343234': error_atmost + error_invalid,
'abcdefghijk': error_invalid,
'2308803439': error_notvalid,
-
+
}
self.assertFieldOutput(ISIdNumberField, valid, invalid)
-
+
def test_ISPhoneNumberField(self):
error_invalid = [u'Enter a valid value.']
error_atleast = [u'Ensure this value has at least 7 characters (it has 6).']
@@ -196,4 +196,3 @@ class ISLocalFlavorTests(SimpleTestCase):
' 12367 ': error_invalid
}
self.assertFieldOutput(ISPhoneNumberField, valid, invalid)
-
diff --git a/tests/regressiontests/localflavor/it/__init__.py b/tests/regressiontests/localflavor/it/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/it.py b/tests/regressiontests/localflavor/it/tests.py
similarity index 99%
rename from tests/regressiontests/forms/localflavor/it.py
rename to tests/regressiontests/localflavor/it/tests.py
index 456a56bf34..cd2a7a3d60 100644
--- a/tests/regressiontests/forms/localflavor/it.py
+++ b/tests/regressiontests/localflavor/it/tests.py
@@ -40,7 +40,7 @@ class ITLocalFlavorTests(SimpleTestCase):
' 00100': error_invalid,
}
self.assertFieldOutput(ITZipCodeField, valid, invalid)
-
+
def test_ITSocialSecurityNumberField(self):
error_invalid = [u'Enter a valid Social Security number.']
valid = {
@@ -54,7 +54,7 @@ class ITLocalFlavorTests(SimpleTestCase):
'%BRRME11A01L736W': error_invalid,
}
self.assertFieldOutput(ITSocialSecurityNumberField, valid, invalid)
-
+
def test_ITVatNumberField(self):
error_invalid = [u'Enter a valid VAT number.']
valid = {
@@ -67,4 +67,3 @@ class ITLocalFlavorTests(SimpleTestCase):
'A7973780013': error_invalid,
}
self.assertFieldOutput(ITVatNumberField, valid, invalid)
-
diff --git a/tests/regressiontests/localflavor/jp/__init__.py b/tests/regressiontests/localflavor/jp/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/jp.py b/tests/regressiontests/localflavor/jp/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/jp.py
rename to tests/regressiontests/localflavor/jp/tests.py
diff --git a/tests/regressiontests/localflavor/kw/__init__.py b/tests/regressiontests/localflavor/kw/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/kw.py b/tests/regressiontests/localflavor/kw/tests.py
similarity index 99%
rename from tests/regressiontests/forms/localflavor/kw.py
rename to tests/regressiontests/localflavor/kw/tests.py
index 3dfeef5469..c46241f4f4 100644
--- a/tests/regressiontests/forms/localflavor/kw.py
+++ b/tests/regressiontests/localflavor/kw/tests.py
@@ -13,4 +13,3 @@ class KWLocalFlavorTests(SimpleTestCase):
'289332013455': error_invalid,
}
self.assertFieldOutput(KWCivilIDNumberField, valid, invalid)
-
diff --git a/tests/regressiontests/localflavor/mk/tests.py b/tests/regressiontests/localflavor/mk/tests.py
index f7f2981a85..754db2d93c 100644
--- a/tests/regressiontests/localflavor/mk/tests.py
+++ b/tests/regressiontests/localflavor/mk/tests.py
@@ -1,7 +1,11 @@
-from django.test import TestCase
+from django.contrib.localflavor.mk.forms import (
+ MKIdentityCardNumberField, MKMunicipalitySelect, UMCNField)
+from django.test import SimpleTestCase
+
from forms import MKPersonForm
-class MKLocalflavorTests(TestCase):
+class MKLocalflavorTests(SimpleTestCase):
+
def setUp(self):
self.form = MKPersonForm({
'first_name':'Someone',
@@ -174,3 +178,127 @@ class MKLocalflavorTests(TestCase):
\xc5\xa0uto Orizari
"""
self.assertEqual(str(self.form['municipality']), municipality_select_html)
+
+ def test_MKIdentityCardNumberField(self):
+ error_invalid = [u'Identity card numbers must contain either 4 to 7 '
+ 'digits or an uppercase letter and 7 digits.']
+ valid = {
+ 'L0018077':'L0018077',
+ 'A0078315' : 'A0078315',
+ }
+ invalid = {
+ '123': error_invalid,
+ 'abcdf': error_invalid,
+ '234390a': error_invalid,
+ }
+ self.assertFieldOutput(MKIdentityCardNumberField, valid, invalid)
+
+ def test_MKMunicipalitySelect(self):
+ f = MKMunicipalitySelect()
+ out=u'''
+Aerodrom
+Ara\u010dinovo
+Berovo
+Bitola
+Bogdanci
+Bogovinje
+Bosilovo
+Brvenica
+Butel
+Valandovo
+Vasilevo
+Vev\u010dani
+Veles
+Vinica
+Vrane\u0161tica
+Vrap\u010di\u0161te
+Gazi Baba
+Gevgelija
+Gostivar
+Gradsko
+Debar
+Debarca
+Del\u010devo
+Demir Kapija
+Demir Hisar
+Dolneni
+Drugovo
+Gjor\u010de Petrov
+\u017delino
+Zajas
+Zelenikovo
+Zrnovci
+Ilinden
+Jegunovce
+Kavadarci
+Karbinci
+Karpo\u0161
+Kisela Voda
+Ki\u010devo
+Kon\u010de
+Ko\u0107ani
+Kratovo
+Kriva Palanka
+Krivoga\u0161tani
+Kru\u0161evo
+Kumanovo
+Lipkovo
+Lozovo
+Mavrovo i Rostu\u0161a
+Makedonska Kamenica
+Makedonski Brod
+Mogila
+Negotino
+Novaci
+Novo Selo
+Oslomej
+Ohrid
+Petrovec
+Peh\u010devo
+Plasnica
+Prilep
+Probi\u0161tip
+Radovi\u0161
+Rankovce
+Resen
+Rosoman
+Saraj
+Sveti Nikole
+Sopi\u0161te
+Star Dojran
+Staro Nagori\u010dane
+Struga
+Strumica
+Studeni\u010dani
+Tearce
+Tetovo
+Centar
+Centar-\u017dupa
+\u010cair
+\u010ca\u0161ka
+\u010ce\u0161inovo-Oble\u0161evo
+\u010cu\u010der-Sandevo
+\u0160tip
+\u0160uto Orizari
+ '''
+ self.assertEqual(f.render('municipality', 'DL' ), out)
+
+ def test_UMCNField(self):
+ error_invalid = [u'This field should contain exactly 13 digits.']
+ error_checksum = [u'The UMCN is not valid.']
+ error_date = [u'The first 7 digits of the UMCN '
+ 'must represent a valid past date.']
+ valid = {
+ '2402983450006': '2402983450006',
+ '2803984430038': '2803984430038',
+ '1909982045004': '1909982045004',
+ }
+ invalid = {
+ '240298345': error_invalid,
+ 'abcdefghj': error_invalid,
+ '2402082450006': error_date,
+ '3002982450006': error_date,
+ '2402983450007': error_checksum,
+ '2402982450006': error_checksum,
+ }
+ self.assertFieldOutput(UMCNField, valid, invalid)
diff --git a/tests/regressiontests/localflavor/mx/mx.py b/tests/regressiontests/localflavor/mx/mx.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/localflavor/mx/tests.py b/tests/regressiontests/localflavor/mx/tests.py
index 40da38a97c..892dc9dc1c 100644
--- a/tests/regressiontests/localflavor/mx/tests.py
+++ b/tests/regressiontests/localflavor/mx/tests.py
@@ -1,8 +1,12 @@
# -*- coding: utf-8 -*-
-from django.test import TestCase
+from django.contrib.localflavor.mx.forms import (MXZipCodeField, MXRFCField,
+ MXStateSelect, MXCURPField)
+from django.test import SimpleTestCase
+
from forms import MXPersonProfileForm
-class MXLocalFlavorTests(TestCase):
+class MXLocalFlavorTests(SimpleTestCase):
+
def setUp(self):
self.form = MXPersonProfileForm({
'state': 'MIC',
@@ -69,3 +73,123 @@ class MXLocalFlavorTests(TestCase):
Zacatecas
"""
self.assertEqual(str(self.form['state']), state_select_html)
+
+ def test_MXStateSelect(self):
+ f = MXStateSelect()
+ out = u'''
+Aguascalientes
+Baja California
+Baja California Sur
+Campeche
+Chihuahua
+Chiapas
+Coahuila
+Colima
+Distrito Federal
+Durango
+Guerrero
+Guanajuato
+Hidalgo
+Jalisco
+Estado de México
+Michoacán
+Morelos
+Nayarit
+Nuevo León
+Oaxaca
+Puebla
+Querétaro
+Quintana Roo
+Sinaloa
+San Luis Potosí
+Sonora
+Tabasco
+Tamaulipas
+Tlaxcala
+Veracruz
+Yucatán
+Zacatecas
+ '''
+ self.assertEqual(f.render('state', 'MIC'), out)
+
+ def test_MXZipCodeField(self):
+ error_format = [u'Enter a valid zip code in the format XXXXX.']
+ valid = {
+ '58120': u'58120',
+ '58502': u'58502',
+ '59310': u'59310',
+ '99999': u'99999',
+ }
+ invalid = {
+ '17000': error_format,
+ '18000': error_format,
+ '19000': error_format,
+ '00000': error_format,
+ }
+ self.assertFieldOutput(MXZipCodeField, valid, invalid)
+
+ def test_MXRFCField(self):
+ error_format = [u'Enter a valid RFC.']
+ error_checksum = [u'Invalid checksum for RFC.']
+ valid = {
+ 'MoFN641205eX5': u'MOFN641205EX5',
+ 'ICa060120873': u'ICA060120873',
+ 'eUcG751104rT0': u'EUCG751104RT0',
+ 'GME08100195A': u'GME08100195A',
+ 'AA&060524KX5': u'AA&060524KX5',
+ 'CAÑ0708045P7': u'CAÑ0708045P7',
+ 'aaa000101aa9': u'AAA000101AA9',
+ }
+ invalid = {
+ 'MED0000000XA': error_format,
+ '0000000000XA': error_format,
+ 'AAA000000AA6': error_format,
+ # Dates
+ 'XXX880002XXX': error_format,
+ 'XXX880200XXX': error_format,
+ 'XXX880132XXX': error_format,
+ 'XXX880230XXX': error_format,
+ 'XXX880431XXX': error_format,
+ # Incorrect checksum
+ 'MOGR650524E73': error_checksum,
+ 'HVA7810058F1': error_checksum,
+ 'MoFN641205eX2': error_checksum,
+ 'ICa060120871': error_checksum,
+ 'eUcG751104rT7': error_checksum,
+ 'GME081001955': error_checksum,
+ 'AA&060524KX9': error_checksum,
+ 'CAÑ0708045P2': error_checksum,
+ }
+ self.assertFieldOutput(MXRFCField, valid, invalid)
+
+ def test_MXCURPField(self):
+ error_format = [u'Enter a valid CURP.']
+ error_checksum = [u'Invalid checksum for CURP.']
+ valid = {
+ 'AaMG890608HDFLJL00': u'AAMG890608HDFLJL00',
+ 'BAAd890419HMNRRV07': u'BAAD890419HMNRRV07',
+ 'VIAA900930MMNClL08': u'VIAA900930MMNCLL08',
+ 'HEGR891009HMNRRD09': u'HEGR891009HMNRRD09',
+ 'MARR890512HMNRMN09': u'MARR890512HMNRMN09',
+ 'MESJ890928HMNZNS00': u'MESJ890928HMNZNS00',
+ 'BAAA890317HDFRLL03': u'BAAA890317HDFRLL03',
+ 'TOMA880125HMNRRNO2': u'TOMA880125HMNRRNO2',
+ 'OOMG890727HMNRSR06': u'OOMG890727HMNRSR06',
+ 'AAAA000101HDFCCC09': u'AAAA000101HDFCCC09',
+ }
+ invalid = {
+ 'AAAA000000HDFCCC09': error_format,
+ 'AAAA000000HDFAAA03': error_format,
+ 'AAAA000000HXXCCC08': error_format,
+ 'AAAA000000XMNCCC02': error_format,
+ 'HEGR891009HMNRRD0A': error_format,
+ 'MARR890512HMNRMN0A': error_format,
+ 'AaMG890608HDFLJL01': error_checksum,
+ 'BAAd890419HMNRRV08': error_checksum,
+ 'VIAA900930MMNClL09': error_checksum,
+ 'MESJ890928HMNZNS01': error_checksum,
+ 'BAAA890317HDFRLL04': error_checksum,
+ 'TOMA880125HMNRRNO3': error_checksum,
+ 'OOMG890727HMNRSR07': error_checksum,
+ }
+ self.assertFieldOutput(MXCURPField, valid, invalid)
diff --git a/tests/regressiontests/localflavor/nl/__init__.py b/tests/regressiontests/localflavor/nl/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/nl.py b/tests/regressiontests/localflavor/nl/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/nl.py
rename to tests/regressiontests/localflavor/nl/tests.py
diff --git a/tests/regressiontests/localflavor/pl/__init__.py b/tests/regressiontests/localflavor/pl/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/pl.py b/tests/regressiontests/localflavor/pl/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/pl.py
rename to tests/regressiontests/localflavor/pl/tests.py
diff --git a/tests/regressiontests/localflavor/pt/__init__.py b/tests/regressiontests/localflavor/pt/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/pt.py b/tests/regressiontests/localflavor/pt/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/pt.py
rename to tests/regressiontests/localflavor/pt/tests.py
diff --git a/tests/regressiontests/localflavor/py/__init__.py b/tests/regressiontests/localflavor/py/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/py.py b/tests/regressiontests/localflavor/py/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/py.py
rename to tests/regressiontests/localflavor/py/tests.py
diff --git a/tests/regressiontests/localflavor/ro/__init__.py b/tests/regressiontests/localflavor/ro/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/ro.py b/tests/regressiontests/localflavor/ro/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/ro.py
rename to tests/regressiontests/localflavor/ro/tests.py
diff --git a/tests/regressiontests/localflavor/ru/__init__.py b/tests/regressiontests/localflavor/ru/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/ru.py b/tests/regressiontests/localflavor/ru/tests.py
similarity index 99%
rename from tests/regressiontests/forms/localflavor/ru.py
rename to tests/regressiontests/localflavor/ru/tests.py
index aecc5598b2..bc292dacc9 100644
--- a/tests/regressiontests/forms/localflavor/ru.py
+++ b/tests/regressiontests/localflavor/ru/tests.py
@@ -1,5 +1,5 @@
from django.contrib.localflavor.ru.forms import *
-
+
from django.test import SimpleTestCase
diff --git a/tests/regressiontests/localflavor/se/__init__.py b/tests/regressiontests/localflavor/se/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/se.py b/tests/regressiontests/localflavor/se/tests.py
similarity index 99%
rename from tests/regressiontests/forms/localflavor/se.py
rename to tests/regressiontests/localflavor/se/tests.py
index 50720bba55..4ae3eaed03 100644
--- a/tests/regressiontests/forms/localflavor/se.py
+++ b/tests/regressiontests/localflavor/se/tests.py
@@ -162,4 +162,3 @@ class SELocalFlavorTests(SimpleTestCase):
}
self.assertFieldOutput(SEPostalCodeField, valid, invalid)
-
diff --git a/tests/regressiontests/localflavor/sk/__init__.py b/tests/regressiontests/localflavor/sk/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/sk.py b/tests/regressiontests/localflavor/sk/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/sk.py
rename to tests/regressiontests/localflavor/sk/tests.py
diff --git a/tests/regressiontests/localflavor/tests.py b/tests/regressiontests/localflavor/tests.py
index 95a5f99128..155f7f759f 100644
--- a/tests/regressiontests/localflavor/tests.py
+++ b/tests/regressiontests/localflavor/tests.py
@@ -1,5 +1,41 @@
+from ar.tests import *
+from at.tests import *
from au.tests import *
+from be.tests import *
+from br.tests import *
+from ca.tests import *
+from ch.tests import *
+from cl.tests import *
+from cn.tests import *
+from co.tests import *
+from cz.tests import *
+from de.tests import *
+from ec.tests import *
+from es.tests import *
+from fi.tests import *
+from fr.tests import *
+from gb.tests import *
+from generic.tests import *
+from hr.tests import *
+from id.tests import *
+from ie.tests import *
+from il.tests import *
+from in_.tests import *
+from is_.tests import *
+from it.tests import *
+from jp.tests import *
+from kw.tests import *
from mk.tests import *
from mx.tests import *
+from nl.tests import *
+from pl.tests import *
+from pt.tests import *
+from py.tests import *
+from ro.tests import *
+from ru.tests import *
+from se.tests import *
+from sk.tests import *
+from tr.tests import *
from us.tests import *
-
+from uy.tests import *
+from za.tests import *
diff --git a/tests/regressiontests/localflavor/tr/__init__.py b/tests/regressiontests/localflavor/tr/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/tr.py b/tests/regressiontests/localflavor/tr/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/tr.py
rename to tests/regressiontests/localflavor/tr/tests.py
diff --git a/tests/regressiontests/localflavor/us/tests.py b/tests/regressiontests/localflavor/us/tests.py
index 59bb6017b3..758dc0bf32 100644
--- a/tests/regressiontests/localflavor/us/tests.py
+++ b/tests/regressiontests/localflavor/us/tests.py
@@ -1,7 +1,12 @@
-from django.test import TestCase
+from django.contrib.localflavor.us.forms import (USZipCodeField,
+ USPhoneNumberField, USStateField, USStateSelect,
+ USSocialSecurityNumberField)
+from django.test import SimpleTestCase
+
from forms import USPlaceForm
-class USLocalflavorTests(TestCase):
+class USLocalflavorTests(SimpleTestCase):
+
def setUp(self):
self.form = USPlaceForm({'state':'GA', 'state_req':'NC', 'postal_code': 'GA', 'name':'impossible'})
@@ -153,3 +158,126 @@ class USLocalflavorTests(TestCase):
Wyoming
"""
self.assertEqual(str(self.form['postal_code']), usps_select_html)
+
+ def test_USStateSelect(self):
+ f = USStateSelect()
+ out = u'''
+Alabama
+Alaska
+American Samoa
+Arizona
+Arkansas
+Armed Forces Americas
+Armed Forces Europe
+Armed Forces Pacific
+California
+Colorado
+Connecticut
+Delaware
+District of Columbia
+Florida
+Georgia
+Guam
+Hawaii
+Idaho
+Illinois
+Indiana
+Iowa
+Kansas
+Kentucky
+Louisiana
+Maine
+Maryland
+Massachusetts
+Michigan
+Minnesota
+Mississippi
+Missouri
+Montana
+Nebraska
+Nevada
+New Hampshire
+New Jersey
+New Mexico
+New York
+North Carolina
+North Dakota
+Northern Mariana Islands
+Ohio
+Oklahoma
+Oregon
+Pennsylvania
+Puerto Rico
+Rhode Island
+South Carolina
+South Dakota
+Tennessee
+Texas
+Utah
+Vermont
+Virgin Islands
+Virginia
+Washington
+West Virginia
+Wisconsin
+Wyoming
+ '''
+ self.assertEqual(f.render('state', 'IL'), out)
+
+ def test_USZipCodeField(self):
+ error_format = [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
+ valid = {
+ '60606': '60606',
+ 60606: '60606',
+ '04000': '04000',
+ '60606-1234': '60606-1234',
+ }
+ invalid = {
+ '4000': error_format,
+ '6060-1234': error_format,
+ '60606-': error_format,
+ }
+ self.assertFieldOutput(USZipCodeField, valid, invalid)
+
+ def test_USPhoneNumberField(self):
+ error_format = [u'Phone numbers must be in XXX-XXX-XXXX format.']
+ valid = {
+ '312-555-1212': '312-555-1212',
+ '3125551212': '312-555-1212',
+ '312 555-1212': '312-555-1212',
+ '(312) 555-1212': '312-555-1212',
+ '312 555 1212': '312-555-1212',
+ '312.555.1212': '312-555-1212',
+ '312.555-1212': '312-555-1212',
+ ' (312) 555.1212 ': '312-555-1212',
+ }
+ invalid = {
+ '555-1212': error_format,
+ '312-55-1212': error_format,
+ }
+ self.assertFieldOutput(USPhoneNumberField, valid, invalid)
+
+ def test_USStateField(self):
+ error_invalid = [u'Enter a U.S. state or territory.']
+ valid = {
+ 'il': 'IL',
+ 'IL': 'IL',
+ 'illinois': 'IL',
+ ' illinois ': 'IL',
+ }
+ invalid = {
+ 60606: error_invalid,
+ }
+ self.assertFieldOutput(USStateField, valid, invalid)
+
+ def test_USSocialSecurityNumberField(self):
+ error_invalid = [u'Enter a valid U.S. Social Security number in XXX-XX-XXXX format.']
+
+ valid = {
+ '987-65-4330': '987-65-4330',
+ '987654330': '987-65-4330',
+ }
+ invalid = {
+ '078-05-1120': error_invalid,
+ }
+ self.assertFieldOutput(USSocialSecurityNumberField, valid, invalid)
diff --git a/tests/regressiontests/localflavor/uy/__init__.py b/tests/regressiontests/localflavor/uy/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/uy.py b/tests/regressiontests/localflavor/uy/tests.py
similarity index 99%
rename from tests/regressiontests/forms/localflavor/uy.py
rename to tests/regressiontests/localflavor/uy/tests.py
index ea1109e932..6c9599fff6 100644
--- a/tests/regressiontests/forms/localflavor/uy.py
+++ b/tests/regressiontests/localflavor/uy/tests.py
@@ -29,7 +29,7 @@ class UYLocalFlavorTests(SimpleTestCase):
Treinta y Tres
'''
self.assertEqual(f.render('departamentos', 'S'), out)
-
+
def test_UYCIField(self):
error_format = [u'Enter a valid CI number in X.XXX.XXX-X,XXXXXXX-X or XXXXXXXX format.']
error_invalid = [u'Enter a valid CI number.']
@@ -49,4 +49,3 @@ class UYLocalFlavorTests(SimpleTestCase):
self.assertFieldOutput(UYCIField, valid, invalid)
self.assertEqual(get_validation_digit(409805), 3)
self.assertEqual(get_validation_digit(1005411), 2)
-
diff --git a/tests/regressiontests/localflavor/za/__init__.py b/tests/regressiontests/localflavor/za/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regressiontests/forms/localflavor/za.py b/tests/regressiontests/localflavor/za/tests.py
similarity index 100%
rename from tests/regressiontests/forms/localflavor/za.py
rename to tests/regressiontests/localflavor/za/tests.py