Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed country-specific localflavor tests.

They now live in separate django-contrib-XX packages.
  • Loading branch information...
commit ffbc599f77120674cd16e6dcac2f22998c84e407 1 parent 24c7d82
@adrianholovaty adrianholovaty authored
Showing with 0 additions and 5,722 deletions.
  1. 0  tests/regressiontests/localflavor/ar/__init__.py
  2. +0 −103 tests/regressiontests/localflavor/ar/tests.py
  3. 0  tests/regressiontests/localflavor/at/__init__.py
  4. +0 −49 tests/regressiontests/localflavor/at/tests.py
  5. 0  tests/regressiontests/localflavor/au/__init__.py
  6. +0 −11 tests/regressiontests/localflavor/au/forms.py
  7. +0 −14 tests/regressiontests/localflavor/au/models.py
  8. +0 −108 tests/regressiontests/localflavor/au/tests.py
  9. 0  tests/regressiontests/localflavor/be/__init__.py
  10. +0 −81 tests/regressiontests/localflavor/be/tests.py
  11. 0  tests/regressiontests/localflavor/br/__init__.py
  12. +0 −146 tests/regressiontests/localflavor/br/tests.py
  13. 0  tests/regressiontests/localflavor/ca/__init__.py
  14. +0 −115 tests/regressiontests/localflavor/ca/tests.py
  15. 0  tests/regressiontests/localflavor/ch/__init__.py
  16. +0 −76 tests/regressiontests/localflavor/ch/tests.py
  17. 0  tests/regressiontests/localflavor/cl/__init__.py
  18. +0 −58 tests/regressiontests/localflavor/cl/tests.py
  19. 0  tests/regressiontests/localflavor/cn/__init__.py
  20. +0 −113 tests/regressiontests/localflavor/cn/tests.py
  21. 0  tests/regressiontests/localflavor/co/__init__.py
  22. +0 −45 tests/regressiontests/localflavor/co/tests.py
  23. 0  tests/regressiontests/localflavor/cz/__init__.py
  24. +0 −80 tests/regressiontests/localflavor/cz/tests.py
  25. 0  tests/regressiontests/localflavor/de/__init__.py
  26. +0 −51 tests/regressiontests/localflavor/de/tests.py
  27. 0  tests/regressiontests/localflavor/ec/__init__.py
  28. +0 −36 tests/regressiontests/localflavor/ec/tests.py
  29. 0  tests/regressiontests/localflavor/es/__init__.py
  30. +0 −173 tests/regressiontests/localflavor/es/tests.py
  31. 0  tests/regressiontests/localflavor/fi/__init__.py
  32. +0 −383 tests/regressiontests/localflavor/fi/tests.py
  33. 0  tests/regressiontests/localflavor/fr/__init__.py
  34. +0 −152 tests/regressiontests/localflavor/fr/tests.py
  35. 0  tests/regressiontests/localflavor/gb/__init__.py
  36. +0 −32 tests/regressiontests/localflavor/gb/tests.py
  37. 0  tests/regressiontests/localflavor/hk/__init__.py
  38. +0 −11 tests/regressiontests/localflavor/hk/forms.py
  39. +0 −35 tests/regressiontests/localflavor/hk/tests.py
  40. 0  tests/regressiontests/localflavor/hr/__init__.py
  41. +0 −192 tests/regressiontests/localflavor/hr/tests.py
  42. 0  tests/regressiontests/localflavor/id/__init__.py
  43. +0 −195 tests/regressiontests/localflavor/id/tests.py
  44. 0  tests/regressiontests/localflavor/ie/__init__.py
  45. +0 −45 tests/regressiontests/localflavor/ie/tests.py
  46. 0  tests/regressiontests/localflavor/il/__init__.py
  47. +0 −41 tests/regressiontests/localflavor/il/tests.py
  48. 0  tests/regressiontests/localflavor/in_/__init__.py
  49. +0 −178 tests/regressiontests/localflavor/in_/tests.py
  50. 0  tests/regressiontests/localflavor/is_/__init__.py
  51. +0 −200 tests/regressiontests/localflavor/is_/tests.py
  52. 0  tests/regressiontests/localflavor/it/__init__.py
  53. +0 −71 tests/regressiontests/localflavor/it/tests.py
  54. 0  tests/regressiontests/localflavor/jp/__init__.py
  55. +0 −75 tests/regressiontests/localflavor/jp/tests.py
  56. 0  tests/regressiontests/localflavor/kw/__init__.py
  57. +0 −17 tests/regressiontests/localflavor/kw/tests.py
  58. 0  tests/regressiontests/localflavor/mk/__init__.py
  59. +0 −11 tests/regressiontests/localflavor/mk/forms.py
  60. +0 −15 tests/regressiontests/localflavor/mk/models.py
  61. +0 −308 tests/regressiontests/localflavor/mk/tests.py
  62. 0  tests/regressiontests/localflavor/mx/__init__.py
  63. +0 −11 tests/regressiontests/localflavor/mx/forms.py
  64. +0 −13 tests/regressiontests/localflavor/mx/models.py
  65. 0  tests/regressiontests/localflavor/mx/mx.py
  66. +0 −198 tests/regressiontests/localflavor/mx/tests.py
  67. 0  tests/regressiontests/localflavor/nl/__init__.py
  68. +0 −64 tests/regressiontests/localflavor/nl/tests.py
  69. 0  tests/regressiontests/localflavor/pl/__init__.py
  70. +0 −480 tests/regressiontests/localflavor/pl/tests.py
  71. 0  tests/regressiontests/localflavor/pt/__init__.py
  72. +0 −33 tests/regressiontests/localflavor/pt/tests.py
  73. 0  tests/regressiontests/localflavor/py/__init__.py
  74. +0 −55 tests/regressiontests/localflavor/py/tests.py
  75. 0  tests/regressiontests/localflavor/ro/__init__.py
  76. +0 −144 tests/regressiontests/localflavor/ro/tests.py
  77. 0  tests/regressiontests/localflavor/ru/__init__.py
  78. +0 −150 tests/regressiontests/localflavor/ru/tests.py
  79. 0  tests/regressiontests/localflavor/se/__init__.py
  80. +0 −166 tests/regressiontests/localflavor/se/tests.py
  81. 0  tests/regressiontests/localflavor/si/__init__.py
  82. +0 −557 tests/regressiontests/localflavor/si/tests.py
  83. 0  tests/regressiontests/localflavor/sk/__init__.py
  84. +0 −118 tests/regressiontests/localflavor/sk/tests.py
  85. +0 −42 tests/regressiontests/localflavor/tests.py
  86. 0  tests/regressiontests/localflavor/tr/__init__.py
  87. +0 −75 tests/regressiontests/localflavor/tr/tests.py
  88. 0  tests/regressiontests/localflavor/us/__init__.py
  89. +0 −11 tests/regressiontests/localflavor/us/forms.py
  90. +0 −15 tests/regressiontests/localflavor/us/models.py
  91. +0 −286 tests/regressiontests/localflavor/us/tests.py
  92. 0  tests/regressiontests/localflavor/uy/__init__.py
  93. +0 −53 tests/regressiontests/localflavor/uy/tests.py
  94. 0  tests/regressiontests/localflavor/za/__init__.py
  95. +0 −31 tests/regressiontests/localflavor/za/tests.py
View
0  tests/regressiontests/localflavor/ar/__init__.py
No changes.
View
103 tests/regressiontests/localflavor/ar/tests.py
@@ -1,103 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.ar.forms import (ARProvinceSelect,
- ARPostalCodeField, ARDNIField, ARCUITField)
-
-from django.test import SimpleTestCase
-
-
-class ARLocalFlavorTests(SimpleTestCase):
- def test_ARProvinceSelect(self):
- f = ARProvinceSelect()
- out = '''<select name="provincias">
-<option value="B">Buenos Aires</option>
-<option value="K">Catamarca</option>
-<option value="H">Chaco</option>
-<option value="U">Chubut</option>
-<option value="C">Ciudad Aut\xf3noma de Buenos Aires</option>
-<option value="X">C\xf3rdoba</option>
-<option value="W">Corrientes</option>
-<option value="E">Entre R\xedos</option>
-<option value="P">Formosa</option>
-<option value="Y">Jujuy</option>
-<option value="L">La Pampa</option>
-<option value="F">La Rioja</option>
-<option value="M">Mendoza</option>
-<option value="N">Misiones</option>
-<option value="Q">Neuqu\xe9n</option>
-<option value="R">R\xedo Negro</option>
-<option value="A" selected="selected">Salta</option>
-<option value="J">San Juan</option>
-<option value="D">San Luis</option>
-<option value="Z">Santa Cruz</option>
-<option value="S">Santa Fe</option>
-<option value="G">Santiago del Estero</option>
-<option value="V">Tierra del Fuego, Ant\xe1rtida e Islas del Atl\xe1ntico Sur</option>
-<option value="T">Tucum\xe1n</option>
-</select>'''
- self.assertHTMLEqual(f.render('provincias', 'A'), out)
-
- def test_ARPostalCodeField(self):
- error_format = ['Enter a postal code in the format NNNN or ANNNNAAA.']
- error_atmost = ['Ensure this value has at most 8 characters (it has 9).']
- error_atleast = ['Ensure this value has at least 4 characters (it has 3).']
- valid = {
- '5000': '5000',
- 'C1064AAB': 'C1064AAB',
- 'c1064AAB': 'C1064AAB',
- 'C1064aab': 'C1064AAB',
- '4400': '4400',
- 'C1064AAB': 'C1064AAB',
- }
- invalid = {
- 'C1064AABB': error_atmost + error_format,
- 'C1064AA': error_format,
- 'C1064AB': error_format,
- '106AAB': error_format,
- '500': error_atleast + error_format,
- '5PPP': error_format,
- }
- self.assertFieldOutput(ARPostalCodeField, valid, invalid)
-
- def test_ARDNIField(self):
- error_length = ['This field requires 7 or 8 digits.']
- error_digitsonly = ['This field requires only numbers.']
- valid = {
- '20123456': '20123456',
- '20.123.456': '20123456',
- '20123456': '20123456',
- '20.123.456': '20123456',
- '20.123456': '20123456',
- '9123456': '9123456',
- '9.123.456': '9123456',
- }
- invalid = {
- '101234566': error_length,
- 'W0123456': error_digitsonly,
- '10,123,456': error_digitsonly,
- }
- self.assertFieldOutput(ARDNIField, valid, invalid)
-
- def test_ARCUITField(self):
- error_format = ['Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format.']
- error_invalid = ['Invalid CUIT.']
- error_legal_type = ['Invalid legal type. Type must be 27, 20, 23 or 30.']
- valid = {
- '20-10123456-9': '20-10123456-9',
- '20-10123456-9': '20-10123456-9',
- '27-10345678-4': '27-10345678-4',
- '20101234569': '20-10123456-9',
- '27103456784': '27-10345678-4',
- '30011111110': '30-01111111-0',
- }
- invalid = {
- '2-10123456-9': error_format,
- '210123456-9': error_format,
- '20-10123456': error_format,
- '20-10123456-': error_format,
- '20-10123456-5': error_invalid,
- '27-10345678-1': error_invalid,
- '27-10345678-1': error_invalid,
- '11211111110': error_legal_type,
- }
- self.assertFieldOutput(ARCUITField, valid, invalid)
View
0  tests/regressiontests/localflavor/at/__init__.py
No changes.
View
49 tests/regressiontests/localflavor/at/tests.py
@@ -1,49 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
- ATSocialSecurityNumberField)
-
-from django.test import SimpleTestCase
-
-
-class ATLocalFlavorTests(SimpleTestCase):
- def test_ATStateSelect(self):
- f = ATStateSelect()
- out = '''<select name="bundesland">
-<option value="BL">Burgenland</option>
-<option value="KA">Carinthia</option>
-<option value="NO">Lower Austria</option>
-<option value="OO">Upper Austria</option>
-<option value="SA">Salzburg</option>
-<option value="ST">Styria</option>
-<option value="TI">Tyrol</option>
-<option value="VO">Vorarlberg</option>
-<option value="WI" selected="selected">Vienna</option>
-</select>'''
- self.assertHTMLEqual(f.render('bundesland', 'WI'), out)
-
- def test_ATZipCodeField(self):
- error_format = ['Enter a zip code in the format XXXX.']
- valid = {
- '1150': '1150',
- '4020': '4020',
- '8020': '8020',
- }
- invalid = {
- '0000' : error_format,
- '0123' : error_format,
- '111222': error_format,
- 'eeffee': error_format,
- }
- self.assertFieldOutput(ATZipCodeField, valid, invalid)
-
- def test_ATSocialSecurityNumberField(self):
- error_format = ['Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
- valid = {
- '1237 010180': '1237 010180',
- }
- invalid = {
- '1237 010181': error_format,
- '12370 010180': error_format,
- }
- self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
View
0  tests/regressiontests/localflavor/au/__init__.py
No changes.
View
11 tests/regressiontests/localflavor/au/forms.py
@@ -1,11 +0,0 @@
-from __future__ import absolute_import
-
-from django.forms import ModelForm
-
-from .models import AustralianPlace
-
-
-class AustralianPlaceForm(ModelForm):
- """ Form for storing an Australian place. """
- class Meta:
- model = AustralianPlace
View
14 tests/regressiontests/localflavor/au/models.py
@@ -1,14 +0,0 @@
-from django.contrib.localflavor.au.models import AUStateField, AUPostCodeField
-from django.db import models
-
-class AustralianPlace(models.Model):
- state = AUStateField(blank=True)
- state_required = AUStateField()
- state_default = AUStateField(default="NSW", blank=True)
- postcode = AUPostCodeField(blank=True)
- postcode_required = AUPostCodeField()
- postcode_default = AUPostCodeField(default="2500", blank=True)
- name = models.CharField(max_length=20)
-
- class Meta:
- app_label = 'localflavor'
View
108 tests/regressiontests/localflavor/au/tests.py
@@ -1,108 +0,0 @@
-from __future__ import absolute_import, unicode_literals
-
-import re
-
-from django.test import SimpleTestCase
-from django.contrib.localflavor.au.forms import (AUPostCodeField,
- AUPhoneNumberField, AUStateSelect)
-
-from .forms import AustralianPlaceForm
-
-
-SELECTED_OPTION_PATTERN = r'<option value="%s" selected="selected">'
-BLANK_OPTION_PATTERN = r'<option value="">'
-INPUT_VALUE_PATTERN = r'<input[^>]*value="%s"[^>]*>'
-
-
-class AULocalflavorTests(SimpleTestCase):
-
- def setUp(self):
- self.form = AustralianPlaceForm(
- {'state':'WA',
- 'state_required':'QLD',
- 'name':'dummy',
- 'postcode':'1234',
- 'postcode_required':'4321',
- })
-
- def test_get_display_methods(self):
- """ Ensure get_*_display() methods are added to model instances. """
- place = self.form.save()
- self.assertEqual(place.get_state_display(), 'Western Australia')
- self.assertEqual(place.get_state_required_display(), 'Queensland')
-
- def test_default_values(self):
- """ Ensure that default values are selected in forms. """
- form = AustralianPlaceForm()
- self.assertTrue(re.search(SELECTED_OPTION_PATTERN % 'NSW',
- str(form['state_default'])))
- self.assertTrue(re.search(INPUT_VALUE_PATTERN % '2500',
- str(form['postcode_default'])))
-
- def test_required(self):
- """ Test that required AUStateFields throw appropriate errors. """
- form = AustralianPlaceForm({'state':'NSW', 'name':'Wollongong'})
- self.assertFalse(form.is_valid())
- self.assertEqual(
- form.errors['state_required'], ['This field is required.'])
- self.assertEqual(
- form.errors['postcode_required'], ['This field is required.'])
-
- def test_field_blank_option(self):
- """ Test that the empty option is there. """
- self.assertTrue(re.search(BLANK_OPTION_PATTERN,
- str(self.form['state'])))
-
- def test_selected_values(self):
- """ Ensure selected states match the initial values provided. """
- self.assertTrue(re.search(SELECTED_OPTION_PATTERN % 'WA',
- str(self.form['state'])))
- self.assertTrue(re.search(SELECTED_OPTION_PATTERN % 'QLD',
- str(self.form['state_required'])))
- self.assertTrue(re.search(INPUT_VALUE_PATTERN % '1234',
- str(self.form['postcode'])))
- self.assertTrue(re.search(INPUT_VALUE_PATTERN % '4321',
- str(self.form['postcode_required'])))
-
- def test_AUStateSelect(self):
- f = AUStateSelect()
- out = '''<select name="state">
-<option value="ACT">Australian Capital Territory</option>
-<option value="NSW" selected="selected">New South Wales</option>
-<option value="NT">Northern Territory</option>
-<option value="QLD">Queensland</option>
-<option value="SA">South Australia</option>
-<option value="TAS">Tasmania</option>
-<option value="VIC">Victoria</option>
-<option value="WA">Western Australia</option>
-</select>'''
- self.assertHTMLEqual(f.render('state', 'NSW'), out)
-
- def test_AUPostCodeField(self):
- error_format = ['Enter a 4 digit postcode.']
- valid = {
- '1234': '1234',
- '2000': '2000',
- }
- invalid = {
- 'abcd': error_format,
- '20001': ['Ensure this value has at most 4 characters (it has 5).'] + error_format,
- }
- self.assertFieldOutput(AUPostCodeField, valid, invalid)
-
- def test_AUPhoneNumberField(self):
- error_format = ['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)
View
0  tests/regressiontests/localflavor/be/__init__.py
No changes.
View
81 tests/regressiontests/localflavor/be/tests.py
@@ -1,81 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.be.forms import (BEPostalCodeField,
- BEPhoneNumberField, BERegionSelect, BEProvinceSelect)
-
-from django.test import SimpleTestCase
-
-
-class BELocalFlavorTests(SimpleTestCase):
- def test_BEPostalCodeField(self):
- error_format = ['Enter a valid postal code in the range and format 1XXX - 9XXX.']
- valid = {
- '1451': '1451',
- '2540': '2540',
- }
- invalid = {
- '0287': error_format,
- '14309': error_format,
- '873': error_format,
- '35 74': error_format,
- '859A': error_format,
- }
- self.assertFieldOutput(BEPostalCodeField, valid, invalid)
-
- def test_BEPhoneNumberField(self):
- error_format = [
- ('Enter a valid phone number in one of the formats 0x xxx xx xx, '
- '0xx xx xx xx, 04xx xx xx xx, 0x/xxx.xx.xx, 0xx/xx.xx.xx, '
- '04xx/xx.xx.xx, 0x.xxx.xx.xx, 0xx.xx.xx.xx, 04xx.xx.xx.xx, '
- '0xxxxxxxx or 04xxxxxxxx.')
- ]
- valid = {
- '01 234 56 78': '01 234 56 78',
- '01/234.56.78': '01/234.56.78',
- '01.234.56.78': '01.234.56.78',
- '012 34 56 78': '012 34 56 78',
- '012/34.56.78': '012/34.56.78',
- '012.34.56.78': '012.34.56.78',
- '0412 34 56 78': '0412 34 56 78',
- '0412/34.56.78': '0412/34.56.78',
- '0412.34.56.78': '0412.34.56.78',
- '012345678': '012345678',
- '0412345678': '0412345678',
- }
- invalid = {
- '01234567': error_format,
- '12/345.67.89': error_format,
- '012/345.678.90': error_format,
- '012/34.56.789': error_format,
- '0123/45.67.89': error_format,
- '012/345 678 90': error_format,
- '012/34 56 789': error_format,
- '012.34 56 789': error_format,
- }
- self.assertFieldOutput(BEPhoneNumberField, valid, invalid)
-
- def test_BERegionSelect(self):
- f = BERegionSelect()
- out = '''<select name="regions">
-<option value="BRU">Brussels Capital Region</option>
-<option value="VLG" selected="selected">Flemish Region</option>
-<option value="WAL">Wallonia</option>
-</select>'''
- self.assertHTMLEqual(f.render('regions', 'VLG'), out)
-
- def test_BEProvinceSelect(self):
- f = BEProvinceSelect()
- out = '''<select name="provinces">
-<option value="VAN">Antwerp</option>
-<option value="BRU">Brussels</option>
-<option value="VOV">East Flanders</option>
-<option value="VBR">Flemish Brabant</option>
-<option value="WHT">Hainaut</option>
-<option value="WLG" selected="selected">Liege</option>
-<option value="VLI">Limburg</option>
-<option value="WLX">Luxembourg</option>
-<option value="WNA">Namur</option>
-<option value="WBR">Walloon Brabant</option>
-<option value="VWV">West Flanders</option>
-</select>'''
- self.assertHTMLEqual(f.render('provinces', 'WLG'), out)
View
0  tests/regressiontests/localflavor/br/__init__.py
No changes.
View
146 tests/regressiontests/localflavor/br/tests.py
@@ -1,146 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.br.forms import (BRZipCodeField,
- BRCNPJField, BRCPFField, BRPhoneNumberField, BRStateSelect,
- BRStateChoiceField)
-
-from django.test import SimpleTestCase
-
-
-class BRLocalFlavorTests(SimpleTestCase):
- def test_BRZipCodeField(self):
- error_format = ['Enter a zip code in the format XXXXX-XXX.']
- valid = {
- '12345-123': '12345-123',
- }
- invalid = {
- '12345_123': error_format,
- '1234-123': error_format,
- 'abcde-abc': error_format,
- '12345-': error_format,
- '-123': error_format,
- }
- self.assertFieldOutput(BRZipCodeField, valid, invalid)
-
- def test_BRCNPJField(self):
- error_format = ['Invalid CNPJ number.']
- error_numbersonly = ['This field requires only numbers.']
- valid = {
- '64.132.916/0001-88': '64.132.916/0001-88',
- '64-132-916/0001-88': '64-132-916/0001-88',
- '64132916/0001-88': '64132916/0001-88',
- }
- invalid = {
- '12-345-678/9012-10': error_format,
- '12.345.678/9012-10': error_format,
- '12345678/9012-10': error_format,
- '64.132.916/0001-XX': error_numbersonly,
- }
- self.assertFieldOutput(BRCNPJField, valid, invalid)
-
- def test_BRCPFField(self):
- error_format = ['Invalid CPF number.']
- error_numbersonly = ['This field requires only numbers.']
- error_atmost_chars = ['Ensure this value has at most 14 characters (it has 15).']
- error_atleast_chars = ['Ensure this value has at least 11 characters (it has 10).']
- error_atmost = ['This field requires at most 11 digits or 14 characters.']
- valid = {
- '663.256.017-26': '663.256.017-26',
- '66325601726': '66325601726',
- '375.788.573-20': '375.788.573-20',
- '84828509895': '84828509895',
- }
- invalid = {
- '489.294.654-54': error_format,
- '295.669.575-98': error_format,
- '539.315.127-22': error_format,
- '375.788.573-XX': error_numbersonly,
- '375.788.573-000': error_atmost_chars,
- '123.456.78': error_atleast_chars,
- '123456789555': error_atmost,
- }
- self.assertFieldOutput(BRCPFField, valid, invalid)
-
- def test_BRPhoneNumberField(self):
- # TODO: this doesn't test for any invalid inputs.
- valid = {
- '41-3562-3464': '41-3562-3464',
- '4135623464': '41-3562-3464',
- '41 3562-3464': '41-3562-3464',
- '41 3562 3464': '41-3562-3464',
- '(41) 3562 3464': '41-3562-3464',
- '41.3562.3464': '41-3562-3464',
- '41.3562-3464': '41-3562-3464',
- ' (41) 3562.3464': '41-3562-3464',
- }
- invalid = {}
- self.assertFieldOutput(BRPhoneNumberField, valid, invalid)
-
- def test_BRStateSelect(self):
- f = BRStateSelect()
- out = '''<select name="states">
-<option value="AC">Acre</option>
-<option value="AL">Alagoas</option>
-<option value="AP">Amap\xe1</option>
-<option value="AM">Amazonas</option>
-<option value="BA">Bahia</option>
-<option value="CE">Cear\xe1</option>
-<option value="DF">Distrito Federal</option>
-<option value="ES">Esp\xedrito Santo</option>
-<option value="GO">Goi\xe1s</option>
-<option value="MA">Maranh\xe3o</option>
-<option value="MT">Mato Grosso</option>
-<option value="MS">Mato Grosso do Sul</option>
-<option value="MG">Minas Gerais</option>
-<option value="PA">Par\xe1</option>
-<option value="PB">Para\xedba</option>
-<option value="PR" selected="selected">Paran\xe1</option>
-<option value="PE">Pernambuco</option>
-<option value="PI">Piau\xed</option>
-<option value="RJ">Rio de Janeiro</option>
-<option value="RN">Rio Grande do Norte</option>
-<option value="RS">Rio Grande do Sul</option>
-<option value="RO">Rond\xf4nia</option>
-<option value="RR">Roraima</option>
-<option value="SC">Santa Catarina</option>
-<option value="SP">S\xe3o Paulo</option>
-<option value="SE">Sergipe</option>
-<option value="TO">Tocantins</option>
-</select>'''
- self.assertHTMLEqual(f.render('states', 'PR'), out)
-
- def test_BRStateChoiceField(self):
- error_invalid = ['Select a valid brazilian state. That state is not one of the available states.']
- valid = {
- 'AC': 'AC',
- 'AL': 'AL',
- 'AP': 'AP',
- 'AM': 'AM',
- 'BA': 'BA',
- 'CE': 'CE',
- 'DF': 'DF',
- 'ES': 'ES',
- 'GO': 'GO',
- 'MA': 'MA',
- 'MT': 'MT',
- 'MS': 'MS',
- 'MG': 'MG',
- 'PA': 'PA',
- 'PB': 'PB',
- 'PR': 'PR',
- 'PE': 'PE',
- 'PI': 'PI',
- 'RJ': 'RJ',
- 'RN': 'RN',
- 'RS': 'RS',
- 'RO': 'RO',
- 'RR': 'RR',
- 'SC': 'SC',
- 'SP': 'SP',
- 'SE': 'SE',
- 'TO': 'TO',
- }
- invalid = {
- 'pr': error_invalid,
- }
- self.assertFieldOutput(BRStateChoiceField, valid, invalid)
View
0  tests/regressiontests/localflavor/ca/__init__.py
No changes.
View
115 tests/regressiontests/localflavor/ca/tests.py
@@ -1,115 +0,0 @@
-from __future__ import unicode_literals
-
-import warnings
-
-from django.contrib.localflavor.ca.forms import (CAPostalCodeField,
- CAPhoneNumberField, CAProvinceField, CAProvinceSelect,
- CASocialInsuranceNumberField)
-
-from django.test import SimpleTestCase
-
-
-class CALocalFlavorTests(SimpleTestCase):
- def setUp(self):
- self.save_warnings_state()
- warnings.filterwarnings(
- "ignore",
- category=RuntimeWarning,
- module='django.contrib.localflavor.ca.ca_provinces'
- )
-
- def tearDown(self):
- self.restore_warnings_state()
-
- def test_CAProvinceSelect(self):
- f = CAProvinceSelect()
- out = '''<select name="province">
-<option value="AB" selected="selected">Alberta</option>
-<option value="BC">British Columbia</option>
-<option value="MB">Manitoba</option>
-<option value="NB">New Brunswick</option>
-<option value="NL">Newfoundland and Labrador</option>
-<option value="NT">Northwest Territories</option>
-<option value="NS">Nova Scotia</option>
-<option value="NU">Nunavut</option>
-<option value="ON">Ontario</option>
-<option value="PE">Prince Edward Island</option>
-<option value="QC">Quebec</option>
-<option value="SK">Saskatchewan</option>
-<option value="YT">Yukon</option>
-</select>'''
- self.assertHTMLEqual(f.render('province', 'AB'), out)
-
- def test_CAPostalCodeField(self):
- error_format = ['Enter a postal code in the format XXX XXX.']
- valid = {
- 'T2S 2H7': 'T2S 2H7',
- 'T2S 2W7': 'T2S 2W7',
- 'T2S 2Z7': 'T2S 2Z7',
- 'T2Z 2H7': 'T2Z 2H7',
- 'T2S2H7' : 'T2S 2H7',
- 't2s 2h7': 'T2S 2H7',
- 't2s2h7' : 'T2S 2H7',
- 't2s 2H7': 'T2S 2H7',
- ' t2s 2H7 ': 'T2S 2H7',
- }
- invalid = {
- 'T2S 2H' : error_format,
- '2T6 H8I': error_format,
- 'T2S2H' : error_format,
- 't2s h8i': error_format,
- 90210 : error_format,
- 'W2S 2H3': error_format,
- 'Z2S 2H3': error_format,
- 'F2S 2H3': error_format,
- 'A2S 2D3': error_format,
- 'A2I 2R3': error_format,
- 'A2Q 2R3': error_format,
- 'U2B 2R3': error_format,
- 'O2B 2R3': error_format,
- }
- self.assertFieldOutput(CAPostalCodeField, valid, invalid)
-
- def test_CAPhoneNumberField(self):
- error_format = ['Phone numbers must be in XXX-XXX-XXXX format.']
- valid = {
- '403-555-1212': '403-555-1212',
- '4035551212': '403-555-1212',
- '403 555-1212': '403-555-1212',
- '(403) 555-1212': '403-555-1212',
- '403 555 1212': '403-555-1212',
- '403.555.1212': '403-555-1212',
- '403.555-1212': '403-555-1212',
- ' (403) 555.1212 ': '403-555-1212',
- }
- invalid = {
- '555-1212': error_format,
- '403-55-1212': error_format,
- }
- self.assertFieldOutput(CAPhoneNumberField, valid, invalid)
-
- def test_CAProvinceField(self):
- error_format = ['Enter a Canadian province or territory.']
- valid = {
- 'ab': 'AB',
- 'BC': 'BC',
- 'nova scotia': 'NS',
- ' manitoba ': 'MB',
- 'pq': 'QC',
- }
- invalid = {
- 'T2S 2H7': error_format,
- }
- self.assertFieldOutput(CAProvinceField, valid, invalid)
-
- def test_CASocialInsuranceField(self):
- error_format = ['Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.']
- valid = {
- '046-454-286': '046-454-286',
- }
- invalid = {
- '046-454-287': error_format,
- '046 454 286': error_format,
- '046-44-286': error_format,
- }
- self.assertFieldOutput(CASocialInsuranceNumberField, valid, invalid)
View
0  tests/regressiontests/localflavor/ch/__init__.py
No changes.
View
76 tests/regressiontests/localflavor/ch/tests.py
@@ -1,76 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.ch.forms import (CHZipCodeField,
- CHPhoneNumberField, CHIdentityCardNumberField, CHStateSelect)
-
-from django.test import SimpleTestCase
-
-
-class CHLocalFlavorTests(SimpleTestCase):
- def test_CHStateSelect(self):
- f = CHStateSelect()
- out = '''<select name="state">
-<option value="AG" selected="selected">Aargau</option>
-<option value="AI">Appenzell Innerrhoden</option>
-<option value="AR">Appenzell Ausserrhoden</option>
-<option value="BS">Basel-Stadt</option>
-<option value="BL">Basel-Land</option>
-<option value="BE">Berne</option>
-<option value="FR">Fribourg</option>
-<option value="GE">Geneva</option>
-<option value="GL">Glarus</option>
-<option value="GR">Graubuenden</option>
-<option value="JU">Jura</option>
-<option value="LU">Lucerne</option>
-<option value="NE">Neuchatel</option>
-<option value="NW">Nidwalden</option>
-<option value="OW">Obwalden</option>
-<option value="SH">Schaffhausen</option>
-<option value="SZ">Schwyz</option>
-<option value="SO">Solothurn</option>
-<option value="SG">St. Gallen</option>
-<option value="TG">Thurgau</option>
-<option value="TI">Ticino</option>
-<option value="UR">Uri</option>
-<option value="VS">Valais</option>
-<option value="VD">Vaud</option>
-<option value="ZG">Zug</option>
-<option value="ZH">Zurich</option>
-</select>'''
- self.assertHTMLEqual(f.render('state', 'AG'), out)
-
- def test_CHZipCodeField(self):
- error_format = ['Enter a zip code in the format XXXX.']
- valid = {
- '1234': '1234',
- '0000': '0000',
- }
- invalid = {
- '800x': error_format,
- '80 00': error_format,
- }
- self.assertFieldOutput(CHZipCodeField, valid, invalid)
-
- def test_CHPhoneNumberField(self):
- error_format = ['Phone numbers must be in 0XX XXX XX XX format.']
- valid = {
- '012 345 67 89': '012 345 67 89',
- '0123456789': '012 345 67 89',
- }
- invalid = {
- '01234567890': error_format,
- '1234567890': error_format,
- }
- self.assertFieldOutput(CHPhoneNumberField, valid, invalid)
-
- def test_CHIdentityCardNumberField(self):
- error_format = ['Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.']
- valid = {
- 'C1234567<0': 'C1234567<0',
- '2123456700': '2123456700',
- }
- invalid = {
- 'C1234567<1': error_format,
- '2123456701': error_format,
- }
- self.assertFieldOutput(CHIdentityCardNumberField, valid, invalid)
View
0  tests/regressiontests/localflavor/cl/__init__.py
No changes.
View
58 tests/regressiontests/localflavor/cl/tests.py
@@ -1,58 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.cl.forms import CLRutField, CLRegionSelect
-
-from django.test import SimpleTestCase
-
-
-class CLLocalFlavorTests(SimpleTestCase):
- def test_CLRegionSelect(self):
- f = CLRegionSelect()
- out = '''<select name="foo">
-<option value="RM">Regi\xf3n Metropolitana de Santiago</option>
-<option value="I">Regi\xf3n de Tarapac\xe1</option>
-<option value="II">Regi\xf3n de Antofagasta</option>
-<option value="III">Regi\xf3n de Atacama</option>
-<option value="IV">Regi\xf3n de Coquimbo</option>
-<option value="V">Regi\xf3n de Valpara\xedso</option>
-<option value="VI">Regi\xf3n del Libertador Bernardo O&#39;Higgins</option>
-<option value="VII">Regi\xf3n del Maule</option>
-<option value="VIII">Regi\xf3n del B\xedo B\xedo</option>
-<option value="IX">Regi\xf3n de la Araucan\xeda</option>
-<option value="X">Regi\xf3n de los Lagos</option>
-<option value="XI">Regi\xf3n de Ays\xe9n del General Carlos Ib\xe1\xf1ez del Campo</option>
-<option value="XII">Regi\xf3n de Magallanes y la Ant\xe1rtica Chilena</option>
-<option value="XIV">Regi\xf3n de Los R\xedos</option>
-<option value="XV">Regi\xf3n de Arica-Parinacota</option>
-</select>'''
- self.assertHTMLEqual(f.render('foo', 'bar'), out)
-
- def test_CLRutField(self):
- error_invalid = ['The Chilean RUT is not valid.']
- error_format = ['Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.']
- valid = {
- '11-6': '11-6',
- '116': '11-6',
- '767484100': '76.748.410-0',
- '78.412.790-7': '78.412.790-7',
- '8.334.6043': '8.334.604-3',
- '76793310-K': '76.793.310-K',
- '76793310-k': '76.793.310-K',
- }
- invalid = {
- '11.111.111-0': error_invalid,
- '111': error_invalid,
- }
- self.assertFieldOutput(CLRutField, valid, invalid)
-
- # deal with special "Strict Mode".
- invalid = {
- '11-6': error_format,
- '767484100': error_format,
- '8.334.6043': error_format,
- '76793310-K': error_format,
- '11.111.111-0': error_invalid
- }
- self.assertFieldOutput(CLRutField,
- {}, invalid, field_kwargs={"strict": True}
- )
View
0  tests/regressiontests/localflavor/cn/__init__.py
No changes.
View
113 tests/regressiontests/localflavor/cn/tests.py
@@ -1,113 +0,0 @@
-# Tests for contrib/localflavor/ CN Form Fields
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.cn.forms import (CNProvinceSelect,
- CNPostCodeField, CNIDCardField, CNPhoneNumberField, CNCellNumberField)
-from django.test import SimpleTestCase
-
-class CNLocalFlavorTests(SimpleTestCase):
- def test_CNProvinceSelect(self):
- f = CNProvinceSelect()
- correct_output = '''<select name="provinces">
-<option value="anhui">\u5b89\u5fbd</option>
-<option value="beijing">\u5317\u4eac</option>
-<option value="chongqing">\u91cd\u5e86</option>
-<option value="fujian">\u798f\u5efa</option>
-<option value="gansu">\u7518\u8083</option>
-<option value="guangdong">\u5e7f\u4e1c</option>
-<option value="guangxi">\u5e7f\u897f\u58ee\u65cf\u81ea\u6cbb\u533a</option>
-<option value="guizhou">\u8d35\u5dde</option>
-<option value="hainan">\u6d77\u5357</option>
-<option value="hebei">\u6cb3\u5317</option>
-<option value="heilongjiang">\u9ed1\u9f99\u6c5f</option>
-<option value="henan">\u6cb3\u5357</option>
-<option value="hongkong">\u9999\u6e2f</option>
-<option value="hubei" selected="selected">\u6e56\u5317</option>
-<option value="hunan">\u6e56\u5357</option>
-<option value="jiangsu">\u6c5f\u82cf</option>
-<option value="jiangxi">\u6c5f\u897f</option>
-<option value="jilin">\u5409\u6797</option>
-<option value="liaoning">\u8fbd\u5b81</option>
-<option value="macao">\u6fb3\u95e8</option>
-<option value="neimongol">\u5185\u8499\u53e4\u81ea\u6cbb\u533a</option>
-<option value="ningxia">\u5b81\u590f\u56de\u65cf\u81ea\u6cbb\u533a</option>
-<option value="qinghai">\u9752\u6d77</option>
-<option value="shaanxi">\u9655\u897f</option>
-<option value="shandong">\u5c71\u4e1c</option>
-<option value="shanghai">\u4e0a\u6d77</option>
-<option value="shanxi">\u5c71\u897f</option>
-<option value="sichuan">\u56db\u5ddd</option>
-<option value="taiwan">\u53f0\u6e7e</option>
-<option value="tianjin">\u5929\u6d25</option>
-<option value="xinjiang">\u65b0\u7586\u7ef4\u543e\u5c14\u81ea\u6cbb\u533a</option>
-<option value="xizang">\u897f\u85cf\u81ea\u6cbb\u533a</option>
-<option value="yunnan">\u4e91\u5357</option>
-<option value="zhejiang">\u6d59\u6c5f</option>
-</select>'''
- self.assertHTMLEqual(f.render('provinces', 'hubei'), correct_output)
-
- def test_CNPostCodeField(self):
- error_format = ['Enter a post code in the format XXXXXX.']
- valid = {
- '091209': '091209'
- }
- invalid = {
- '09120': error_format,
- '09120916': error_format
- }
- self.assertFieldOutput(CNPostCodeField, valid, invalid)
-
- def test_CNIDCardField(self):
- valid = {
- # A valid 1st generation ID Card Number.
- '110101491001001': '110101491001001',
- # A valid 2nd generation ID Card number.
- '11010119491001001X': '11010119491001001X',
- # Another valid 2nd gen ID Number with a case change
- '11010119491001001x': '11010119491001001X'
- }
-
- wrong_format = ['ID Card Number consists of 15 or 18 digits.']
- wrong_location = ['Invalid ID Card Number: Wrong location code']
- wrong_bday = ['Invalid ID Card Number: Wrong birthdate']
- wrong_checksum = ['Invalid ID Card Number: Wrong checksum']
-
- invalid = {
- 'abcdefghijklmnop': wrong_format,
- '1010101010101010': wrong_format,
- '010101491001001' : wrong_location, # 1st gen, 01 is invalid
- '110101491041001' : wrong_bday, # 1st gen. There wasn't day 41
- '92010119491001001X': wrong_location, # 2nd gen, 92 is invalid
- '91010119491301001X': wrong_bday, # 2nd gen, 19491301 is invalid date
- '910101194910010014': wrong_checksum #2nd gen
- }
- self.assertFieldOutput(CNIDCardField, valid, invalid)
-
- def test_CNPhoneNumberField(self):
- error_format = ['Enter a valid phone number.']
- valid = {
- '010-12345678': '010-12345678',
- '010-1234567': '010-1234567',
- '0101-12345678': '0101-12345678',
- '0101-1234567': '0101-1234567',
- '010-12345678-020':'010-12345678-020'
- }
- invalid = {
- '01x-12345678': error_format,
- '12345678': error_format,
- '01123-12345678': error_format,
- '010-123456789': error_format,
- '010-12345678-': error_format
- }
- self.assertFieldOutput(CNPhoneNumberField, valid, invalid)
-
- def test_CNCellNumberField(self):
- error_format = ['Enter a valid cell number.']
- valid = {
- '13012345678': '13012345678',
- }
- invalid = {
- '130123456789': error_format,
- '14012345678': error_format
- }
- self.assertFieldOutput(CNCellNumberField, valid, invalid)
View
0  tests/regressiontests/localflavor/co/__init__.py
No changes.
View
45 tests/regressiontests/localflavor/co/tests.py
@@ -1,45 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.co.forms import CODepartmentSelect
-
-from django.test import SimpleTestCase
-
-class COLocalFlavorTests(SimpleTestCase):
- def test_CODepartmentSelect(self):
- d = CODepartmentSelect()
- out = """<select name="department">
-<option value="AMA">Amazonas</option>
-<option value="ANT">Antioquia</option>
-<option value="ARA">Arauca</option>
-<option value="ATL">Atl\xe1ntico</option>
-<option value="DC">Bogot\xe1</option>
-<option value="BOL">Bol\xedvar</option>
-<option value="BOY">Boyac\xe1</option>
-<option value="CAL">Caldas</option>
-<option value="CAQ">Caquet\xe1</option>
-<option value="CAS">Casanare</option>
-<option value="CAU">Cauca</option>
-<option value="CES">Cesar</option>
-<option value="CHO">Choc\xf3</option>
-<option value="COR" selected="selected">C\xf3rdoba</option>
-<option value="CUN">Cundinamarca</option>
-<option value="GUA">Guain\xeda</option>
-<option value="GUV">Guaviare</option>
-<option value="HUI">Huila</option>
-<option value="LAG">La Guajira</option>
-<option value="MAG">Magdalena</option>
-<option value="MET">Meta</option>
-<option value="NAR">Nari\xf1o</option>
-<option value="NSA">Norte de Santander</option>
-<option value="PUT">Putumayo</option>
-<option value="QUI">Quind\xedo</option>
-<option value="RIS">Risaralda</option>
-<option value="SAP">San Andr\xe9s and Providencia</option>
-<option value="SAN">Santander</option>
-<option value="SUC">Sucre</option>
-<option value="TOL">Tolima</option>
-<option value="VAC">Valle del Cauca</option>
-<option value="VAU">Vaup\xe9s</option>
-<option value="VID">Vichada</option>
-</select>"""
- self.assertHTMLEqual(d.render('department', 'COR'), out)
View
0  tests/regressiontests/localflavor/cz/__init__.py
No changes.
View
80 tests/regressiontests/localflavor/cz/tests.py
@@ -1,80 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.cz.forms import (CZPostalCodeField,
- CZRegionSelect, CZBirthNumberField, CZICNumberField)
-
-from django.core.exceptions import ValidationError
-from django.test import SimpleTestCase
-
-
-class CZLocalFlavorTests(SimpleTestCase):
- def test_CZRegionSelect(self):
- f = CZRegionSelect()
- out = '''<select name="regions">
-<option value="PR">Prague</option>
-<option value="CE">Central Bohemian Region</option>
-<option value="SO">South Bohemian Region</option>
-<option value="PI">Pilsen Region</option>
-<option value="CA">Carlsbad Region</option>
-<option value="US">Usti Region</option>
-<option value="LB">Liberec Region</option>
-<option value="HK">Hradec Region</option>
-<option value="PA">Pardubice Region</option>
-<option value="VY">Vysocina Region</option>
-<option value="SM">South Moravian Region</option>
-<option value="OL">Olomouc Region</option>
-<option value="ZL">Zlin Region</option>
-<option value="MS">Moravian-Silesian Region</option>
-</select>'''
- self.assertHTMLEqual(f.render('regions', 'TT'), out)
-
- def test_CZPostalCodeField(self):
- error_format = ['Enter a postal code in the format XXXXX or XXX XX.']
- valid = {
- '91909': '91909',
- '917 01': '91701',
- '12345': '12345',
- }
- invalid = {
- '84545x': error_format,
- '123456': error_format,
- '1234': error_format,
- '123 4': error_format,
- }
- self.assertFieldOutput(CZPostalCodeField, valid, invalid)
-
- def test_CZBirthNumberField(self):
- error_format = ['Enter a birth number in the format XXXXXX/XXXX or XXXXXXXXXX.']
- error_invalid = ['Enter a valid birth number.']
- valid = {
- '880523/1237': '880523/1237',
- '8805231237': '8805231237',
- '880523/000': '880523/000',
- '880523000': '880523000',
- '882101/0011': '882101/0011',
- }
- invalid = {
- '123456/12': error_format,
- '123456/12345': error_format,
- '12345612': error_format,
- '12345612345': error_format,
- '880523/1239': error_invalid,
- '8805231239': error_invalid,
- '990101/0011': error_invalid,
- }
- self.assertFieldOutput(CZBirthNumberField, valid, invalid)
-
- def test_CZICNumberField(self):
- error_invalid = ['Enter a valid IC number.']
- valid ={
- '12345679': '12345679',
- '12345601': '12345601',
- '12345661': '12345661',
- '12345610': '12345610',
- }
- invalid = {
- '1234567': error_invalid,
- '12345660': error_invalid,
- '12345600': error_invalid,
- }
- self.assertFieldOutput(CZICNumberField, valid, invalid)
View
0  tests/regressiontests/localflavor/de/__init__.py
No changes.
View
51 tests/regressiontests/localflavor/de/tests.py
@@ -1,51 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.de.forms import (DEZipCodeField, DEStateSelect,
- DEIdentityCardNumberField)
-
-from django.test import SimpleTestCase
-
-
-class DELocalFlavorTests(SimpleTestCase):
- def test_DEStateSelect(self):
- f = DEStateSelect()
- out = '''<select name="states">
-<option value="BW">Baden-Wuerttemberg</option>
-<option value="BY">Bavaria</option>
-<option value="BE">Berlin</option>
-<option value="BB">Brandenburg</option>
-<option value="HB">Bremen</option>
-<option value="HH">Hamburg</option>
-<option value="HE">Hessen</option>
-<option value="MV">Mecklenburg-Western Pomerania</option>
-<option value="NI">Lower Saxony</option>
-<option value="NW">North Rhine-Westphalia</option>
-<option value="RP">Rhineland-Palatinate</option>
-<option value="SL">Saarland</option>
-<option value="SN">Saxony</option>
-<option value="ST">Saxony-Anhalt</option>
-<option value="SH">Schleswig-Holstein</option>
-<option value="TH" selected="selected">Thuringia</option>
-</select>'''
- self.assertHTMLEqual(f.render('states', 'TH'), out)
-
- def test_DEZipCodeField(self):
- error_format = ['Enter a zip code in the format XXXXX.']
- valid = {
- '99423': '99423',
- }
- invalid = {
- ' 99423': error_format,
- }
- self.assertFieldOutput(DEZipCodeField, valid, invalid)
-
- def test_DEIdentityCardNumberField(self):
- error_format = ['Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.']
- valid = {
- '7549313035D-6004103-0903042-0': '7549313035D-6004103-0903042-0',
- '9786324830D 6104243 0910271 2': '9786324830D-6104243-0910271-2',
- }
- invalid = {
- '0434657485D-6407276-0508137-9': error_format,
- }
- self.assertFieldOutput(DEIdentityCardNumberField, valid, invalid)
View
0  tests/regressiontests/localflavor/ec/__init__.py
No changes.
View
36 tests/regressiontests/localflavor/ec/tests.py
@@ -1,36 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.ec.forms import ECProvinceSelect
-
-from django.test import SimpleTestCase
-
-class ECLocalFlavorTests(SimpleTestCase):
- def test_ECProvinceSelect(self):
- p = ECProvinceSelect()
- out = """<select name="province">
-<option value="A">Azuay</option>
-<option value="B">Bol\xedvar</option>
-<option value="F">Ca\xf1ar</option>
-<option value="C">Carchi</option>
-<option value="H">Chimborazo</option>
-<option value="X">Cotopaxi</option>
-<option value="O">El Oro</option>
-<option value="E">Esmeraldas</option>
-<option value="W">Gal\xe1pagos</option>
-<option value="G">Guayas</option>
-<option value="I">Imbabura</option>
-<option value="L">Loja</option>
-<option value="R">Los R\xedos</option>
-<option value="M">Manab\xed</option>
-<option value="S">Morona Santiago</option>
-<option value="N">Napo</option>
-<option value="D">Orellana</option>
-<option value="Y">Pastaza</option>
-<option value="P">Pichincha</option>
-<option value="SE">Santa Elena</option>
-<option value="SD">Santo Domingo de los Ts\xe1chilas</option>
-<option value="U" selected="selected">Sucumb\xedos</option>
-<option value="T">Tungurahua</option>
-<option value="Z">Zamora Chinchipe</option>
-</select>"""
- self.assertHTMLEqual(p.render('province', 'U'), out)
View
0  tests/regressiontests/localflavor/es/__init__.py
No changes.
View
173 tests/regressiontests/localflavor/es/tests.py
@@ -1,173 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.es.forms import (ESPostalCodeField, ESPhoneNumberField,
- ESIdentityCardNumberField, ESCCCField, ESRegionSelect, ESProvinceSelect)
-
-from django.test import SimpleTestCase
-
-
-class ESLocalFlavorTests(SimpleTestCase):
- def test_ESRegionSelect(self):
- f = ESRegionSelect()
- out = '''<select name="regions">
-<option value="AN">Andalusia</option>
-<option value="AR">Aragon</option>
-<option value="O">Principality of Asturias</option>
-<option value="IB">Balearic Islands</option>
-<option value="PV">Basque Country</option>
-<option value="CN">Canary Islands</option>
-<option value="S">Cantabria</option>
-<option value="CM">Castile-La Mancha</option>
-<option value="CL">Castile and Leon</option>
-<option value="CT" selected="selected">Catalonia</option>
-<option value="EX">Extremadura</option>
-<option value="GA">Galicia</option>
-<option value="LO">La Rioja</option>
-<option value="M">Madrid</option>
-<option value="MU">Region of Murcia</option>
-<option value="NA">Foral Community of Navarre</option>
-<option value="VC">Valencian Community</option>
-</select>'''
- self.assertHTMLEqual(f.render('regions', 'CT'), out)
-
- def test_ESProvinceSelect(self):
- f = ESProvinceSelect()
- out = '''<select name="provinces">
-<option value="01">Araba</option>
-<option value="02">Albacete</option>
-<option value="03">Alacant</option>
-<option value="04">Almeria</option>
-<option value="05">Avila</option>
-<option value="06">Badajoz</option>
-<option value="07">Illes Balears</option>
-<option value="08" selected="selected">Barcelona</option>
-<option value="09">Burgos</option>
-<option value="10">Caceres</option>
-<option value="11">Cadiz</option>
-<option value="12">Castello</option>
-<option value="13">Ciudad Real</option>
-<option value="14">Cordoba</option>
-<option value="15">A Coruna</option>
-<option value="16">Cuenca</option>
-<option value="17">Girona</option>
-<option value="18">Granada</option>
-<option value="19">Guadalajara</option>
-<option value="20">Guipuzkoa</option>
-<option value="21">Huelva</option>
-<option value="22">Huesca</option>
-<option value="23">Jaen</option>
-<option value="24">Leon</option>
-<option value="25">Lleida</option>
-<option value="26">La Rioja</option>
-<option value="27">Lugo</option>
-<option value="28">Madrid</option>
-<option value="29">Malaga</option>
-<option value="30">Murcia</option>
-<option value="31">Navarre</option>
-<option value="32">Ourense</option>
-<option value="33">Asturias</option>
-<option value="34">Palencia</option>
-<option value="35">Las Palmas</option>
-<option value="36">Pontevedra</option>
-<option value="37">Salamanca</option>
-<option value="38">Santa Cruz de Tenerife</option>
-<option value="39">Cantabria</option>
-<option value="40">Segovia</option>
-<option value="41">Seville</option>
-<option value="42">Soria</option>
-<option value="43">Tarragona</option>
-<option value="44">Teruel</option>
-<option value="45">Toledo</option>
-<option value="46">Valencia</option>
-<option value="47">Valladolid</option>
-<option value="48">Bizkaia</option>
-<option value="49">Zamora</option>
-<option value="50">Zaragoza</option>
-<option value="51">Ceuta</option>
-<option value="52">Melilla</option>
-</select>'''
- self.assertHTMLEqual(f.render('provinces', '08'), out)
-
- def test_ESPostalCodeField(self):
- error_invalid = ['Enter a valid postal code in the range and format 01XXX - 52XXX.']
- valid = {
- '08028': '08028',
- '28080': '28080',
- }
- invalid = {
- '53001': error_invalid,
- '0801': error_invalid,
- '080001': error_invalid,
- '00999': error_invalid,
- '08 01': error_invalid,
- '08A01': error_invalid,
- }
- self.assertFieldOutput(ESPostalCodeField, valid, invalid)
-
- def test_ESPhoneNumberField(self):
- error_invalid = ['Enter a valid phone number in one of the formats 6XXXXXXXX, 8XXXXXXXX or 9XXXXXXXX.']
- valid = {
- '650010101': '650010101',
- '931234567': '931234567',
- '800123123': '800123123',
- '789789789': '789789789',
- }
- invalid = {
- '555555555': error_invalid,
- '489489489': error_invalid,
- '99123123': error_invalid,
- '9999123123': error_invalid,
- }
- self.assertFieldOutput(ESPhoneNumberField, valid, invalid)
-
- def test_ESIdentityCardNumberField(self):
- error_invalid = ['Please enter a valid NIF, NIE, or CIF.']
- error_checksum_nif = ['Invalid checksum for NIF.']
- error_checksum_nie = ['Invalid checksum for NIE.']
- error_checksum_cif = ['Invalid checksum for CIF.']
- valid = {
- '78699688J': '78699688J',
- '78699688-J': '78699688J',
- '78699688 J': '78699688J',
- '78699688 j': '78699688J',
- 'X0901797J': 'X0901797J',
- 'X-6124387-Q': 'X6124387Q',
- 'X 0012953 G': 'X0012953G',
- 'x-3287690-r': 'X3287690R',
- 't-03287690r': 'T03287690R',
- 'P2907500I': 'P2907500I',
- 'B38790911': 'B38790911',
- 'B31234560': 'B31234560',
- 'B-3879091A': 'B3879091A',
- 'B 38790911': 'B38790911',
- 'P-3900800-H': 'P3900800H',
- 'P 39008008': 'P39008008',
- 'C-28795565': 'C28795565',
- 'C 2879556E': 'C2879556E',
- }
- invalid = {
- '78699688T': error_checksum_nif,
- 'X-03287690': error_invalid,
- 'X-03287690-T': error_checksum_nie,
- 'B 38790917': error_checksum_cif,
- 'C28795567': error_checksum_cif,
- 'I38790911': error_invalid,
- '78699688-2': error_invalid,
- }
- self.assertFieldOutput(ESIdentityCardNumberField, valid, invalid)
-
- def test_ESCCCField(self):
- error_invalid = ['Please enter a valid bank account number in format XXXX-XXXX-XX-XXXXXXXXXX.']
- error_checksum = ['Invalid checksum for bank account number.']
- valid = {
- '20770338793100254321': '20770338793100254321',
- '2077 0338 79 3100254321': '2077 0338 79 3100254321',
- '2077-0338-79-3100254321': '2077-0338-79-3100254321',
- }
- invalid = {
- '2077.0338.79.3100254321': error_invalid,
- '2077-0338-78-3100254321': error_checksum,
- '2077-0338-89-3100254321': error_checksum,
- '2077-03-3879-3100254321': error_invalid,
- }
- self.assertFieldOutput(ESCCCField, valid, invalid)
View
0  tests/regressiontests/localflavor/fi/__init__.py
No changes.
View
383 tests/regressiontests/localflavor/fi/tests.py
@@ -1,383 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.fi.forms import (FIZipCodeField,
- FISocialSecurityNumber, FIMunicipalitySelect)
-
-from django.test import SimpleTestCase
-
-
-class FILocalFlavorTests(SimpleTestCase):
- def test_FIMunicipalitySelect(self):
- f = FIMunicipalitySelect()
- out = '''<select name="municipalities">
-<option value="akaa">Akaa</option>
-<option value="alajarvi">Alaj\xe4rvi</option>
-<option value="alavieska">Alavieska</option>
-<option value="alavus">Alavus</option>
-<option value="artjarvi">Artj\xe4rvi</option>
-<option value="asikkala">Asikkala</option>
-<option value="askola">Askola</option>
-<option value="aura">Aura</option>
-<option value="brando">Br\xe4nd\xf6</option>
-<option value="eckero">Ecker\xf6</option>
-<option value="enonkoski">Enonkoski</option>
-<option value="enontekio">Enonteki\xf6</option>
-<option value="espoo">Espoo</option>
-<option value="eura">Eura</option>
-<option value="eurajoki">Eurajoki</option>
-<option value="evijarvi">Evij\xe4rvi</option>
-<option value="finstrom">Finstr\xf6m</option>
-<option value="forssa">Forssa</option>
-<option value="foglo">F\xf6gl\xf6</option>
-<option value="geta">Geta</option>
-<option value="haapajarvi">Haapaj\xe4rvi</option>
-<option value="haapavesi">Haapavesi</option>
-<option value="hailuoto">Hailuoto</option>
-<option value="halsua">Halsua</option>
-<option value="hamina">Hamina</option>
-<option value="hammarland">Hammarland</option>
-<option value="hankasalmi">Hankasalmi</option>
-<option value="hanko">Hanko</option>
-<option value="harjavalta">Harjavalta</option>
-<option value="hartola">Hartola</option>
-<option value="hattula">Hattula</option>
-<option value="haukipudas">Haukipudas</option>
-<option value="hausjarvi">Hausj\xe4rvi</option>
-<option value="heinola">Heinola</option>
-<option value="heinavesi">Hein\xe4vesi</option>
-<option value="helsinki">Helsinki</option>
-<option value="hirvensalmi">Hirvensalmi</option>
-<option value="hollola">Hollola</option>
-<option value="honkajoki">Honkajoki</option>
-<option value="huittinen">Huittinen</option>
-<option value="humppila">Humppila</option>
-<option value="hyrynsalmi">Hyrynsalmi</option>
-<option value="hyvinkaa">Hyvink\xe4\xe4</option>
-<option value="hameenkoski">H\xe4meenkoski</option>
-<option value="hameenkyro">H\xe4meenkyr\xf6</option>
-<option value="hameenlinna">H\xe4meenlinna</option>
-<option value="ii">Ii</option>
-<option value="iisalmi">Iisalmi</option>
-<option value="iitti">Iitti</option>
-<option value="ikaalinen">Ikaalinen</option>
-<option value="ilmajoki">Ilmajoki</option>
-<option value="ilomantsi">Ilomantsi</option>
-<option value="imatra">Imatra</option>
-<option value="inari">Inari</option>
-<option value="inkoo">Inkoo</option>
-<option value="isojoki">Isojoki</option>
-<option value="isokyro">Isokyr\xf6</option>
-<option value="jalasjarvi">Jalasj\xe4rvi</option>
-<option value="janakkala">Janakkala</option>
-<option value="joensuu">Joensuu</option>
-<option value="jokioinen">Jokioinen</option>
-<option value="jomala">Jomala</option>
-<option value="joroinen">Joroinen</option>
-<option value="joutsa">Joutsa</option>
-<option value="juankoski">Juankoski</option>
-<option value="juuka">Juuka</option>
-<option value="juupajoki">Juupajoki</option>
-<option value="juva">Juva</option>
-<option value="jyvaskyla">Jyv\xe4skyl\xe4</option>
-<option value="jamijarvi">J\xe4mij\xe4rvi</option>
-<option value="jamsa">J\xe4ms\xe4</option>
-<option value="jarvenpaa">J\xe4rvenp\xe4\xe4</option>
-<option value="kaarina">Kaarina</option>
-<option value="kaavi">Kaavi</option>
-<option value="kajaani">Kajaani</option>
-<option value="kalajoki">Kalajoki</option>
-<option value="kangasala">Kangasala</option>
-<option value="kangasniemi">Kangasniemi</option>
-<option value="kankaanpaa">Kankaanp\xe4\xe4</option>
-<option value="kannonkoski">Kannonkoski</option>
-<option value="kannus">Kannus</option>
-<option value="karijoki">Karijoki</option>
-<option value="karjalohja">Karjalohja</option>
-<option value="karkkila">Karkkila</option>
-<option value="karstula">Karstula</option>
-<option value="karttula">Karttula</option>
-<option value="karvia">Karvia</option>
-<option value="kaskinen">Kaskinen</option>
-<option value="kauhajoki">Kauhajoki</option>
-<option value="kauhava">Kauhava</option>
-<option value="kauniainen">Kauniainen</option>
-<option value="kaustinen">Kaustinen</option>
-<option value="keitele">Keitele</option>
-<option value="kemi">Kemi</option>
-<option value="kemijarvi">Kemij\xe4rvi</option>
-<option value="keminmaa">Keminmaa</option>
-<option value="kemionsaari">Kemi\xf6nsaari</option>
-<option value="kempele">Kempele</option>
-<option value="kerava">Kerava</option>
-<option value="kerimaki">Kerim\xe4ki</option>
-<option value="kesalahti">Kes\xe4lahti</option>
-<option value="keuruu">Keuruu</option>
-<option value="kihnio">Kihni\xf6</option>
-<option value="kiikoinen">Kiikoinen</option>
-<option value="kiiminki">Kiiminki</option>
-<option value="kinnula">Kinnula</option>
-<option value="kirkkonummi">Kirkkonummi</option>
-<option value="kitee">Kitee</option>
-<option value="kittila">Kittil\xe4</option>
-<option value="kiuruvesi">Kiuruvesi</option>
-<option value="kivijarvi">Kivij\xe4rvi</option>
-<option value="kokemaki">Kokem\xe4ki</option>
-<option value="kokkola">Kokkola</option>
-<option value="kolari">Kolari</option>
-<option value="konnevesi">Konnevesi</option>
-<option value="kontiolahti">Kontiolahti</option>
-<option value="korsnas">Korsn\xe4s</option>
-<option value="koskitl">Koski Tl</option>
-<option value="kotka">Kotka</option>
-<option value="kouvola">Kouvola</option>
-<option value="kristiinankaupunki">Kristiinankaupunki</option>
-<option value="kruunupyy">Kruunupyy</option>
-<option value="kuhmalahti">Kuhmalahti</option>
-<option value="kuhmo">Kuhmo</option>
-<option value="kuhmoinen">Kuhmoinen</option>
-<option value="kumlinge">Kumlinge</option>
-<option value="kuopio">Kuopio</option>
-<option value="kuortane">Kuortane</option>
-<option value="kurikka">Kurikka</option>
-<option value="kustavi">Kustavi</option>
-<option value="kuusamo">Kuusamo</option>
-<option value="kylmakoski">Kylm\xe4koski</option>
-<option value="kyyjarvi">Kyyj\xe4rvi</option>
-<option value="karkola">K\xe4rk\xf6l\xe4</option>
-<option value="karsamaki">K\xe4rs\xe4m\xe4ki</option>
-<option value="kokar">K\xf6kar</option>
-<option value="koylio">K\xf6yli\xf6</option>
-<option value="lahti">Lahti</option>
-<option value="laihia">Laihia</option>
-<option value="laitila">Laitila</option>
-<option value="lapinjarvi">Lapinj\xe4rvi</option>
-<option value="lapinlahti">Lapinlahti</option>
-<option value="lappajarvi">Lappaj\xe4rvi</option>
-<option value="lappeenranta">Lappeenranta</option>
-<option value="lapua">Lapua</option>
-<option value="laukaa">Laukaa</option>
-<option value="lavia">Lavia</option>
-<option value="lemi">Lemi</option>
-<option value="lemland">Lemland</option>
-<option value="lempaala">Lemp\xe4\xe4l\xe4</option>
-<option value="leppavirta">Lepp\xe4virta</option>
-<option value="lestijarvi">Lestij\xe4rvi</option>
-<option value="lieksa">Lieksa</option>
-<option value="lieto">Lieto</option>
-<option value="liminka">Liminka</option>
-<option value="liperi">Liperi</option>
-<option value="lohja">Lohja</option>
-<option value="loimaa">Loimaa</option>
-<option value="loppi">Loppi</option>
-<option value="loviisa">Loviisa</option>
-<option value="luhanka">Luhanka</option>
-<option value="lumijoki">Lumijoki</option>
-<option value="lumparland">Lumparland</option>
-<option value="luoto">Luoto</option>
-<option value="luumaki">Luum\xe4ki</option>
-<option value="luvia">Luvia</option>
-<option value="lansi-turunmaa">L\xe4nsi-Turunmaa</option>
-<option value="maalahti">Maalahti</option>
-<option value="maaninka">Maaninka</option>
-<option value="maarianhamina">Maarianhamina</option>
-<option value="marttila">Marttila</option>
-<option value="masku">Masku</option>
-<option value="merijarvi">Merij\xe4rvi</option>
-<option value="merikarvia">Merikarvia</option>
-<option value="miehikkala">Miehikk\xe4l\xe4</option>
-<option value="mikkeli">Mikkeli</option>
-<option value="muhos">Muhos</option>
-<option value="multia">Multia</option>
-<option value="muonio">Muonio</option>
-<option value="mustasaari">Mustasaari</option>
-<option value="muurame">Muurame</option>
-<option value="mynamaki">Myn\xe4m\xe4ki</option>
-<option value="myrskyla">Myrskyl\xe4</option>
-<option value="mantsala">M\xe4nts\xe4l\xe4</option>
-<option value="mantta-vilppula">M\xe4ntt\xe4-Vilppula</option>
-<option value="mantyharju">M\xe4ntyharju</option>
-<option value="naantali">Naantali</option>
-<option value="nakkila">Nakkila</option>
-<option value="nastola">Nastola</option>
-<option value="nilsia">Nilsi\xe4</option>
-<option value="nivala">Nivala</option>
-<option value="nokia">Nokia</option>
-<option value="nousiainen">Nousiainen</option>
-<option value="nummi-pusula">Nummi-Pusula</option>
-<option value="nurmes">Nurmes</option>
-<option value="nurmijarvi">Nurmij\xe4rvi</option>
-<option value="narpio">N\xe4rpi\xf6</option>
-<option value="oravainen">Oravainen</option>
-<option value="orimattila">Orimattila</option>
-<option value="oripaa">Orip\xe4\xe4</option>
-<option value="orivesi">Orivesi</option>
-<option value="oulainen">Oulainen</option>
-<option value="oulu">Oulu</option>
-<option value="oulunsalo">Oulunsalo</option>
-<option value="outokumpu">Outokumpu</option>
-<option value="padasjoki">Padasjoki</option>
-<option value="paimio">Paimio</option>
-<option value="paltamo">Paltamo</option>
-<option value="parikkala">Parikkala</option>
-<option value="parkano">Parkano</option>
-<option value="pedersore">Peders\xf6re</option>
-<option value="pelkosenniemi">Pelkosenniemi</option>
-<option value="pello">Pello</option>
-<option value="perho">Perho</option>
-<option value="pertunmaa">Pertunmaa</option>
-<option value="petajavesi">Pet\xe4j\xe4vesi</option>
-<option value="pieksamaki">Pieks\xe4m\xe4ki</option>
-<option value="pielavesi">Pielavesi</option>
-<option value="pietarsaari">Pietarsaari</option>
-<option value="pihtipudas">Pihtipudas</option>
-<option value="pirkkala">Pirkkala</option>
-<option value="polvijarvi">Polvij\xe4rvi</option>
-<option value="pomarkku">Pomarkku</option>
-<option value="pori">Pori</option>
-<option value="pornainen">Pornainen</option>
-<option value="porvoo">Porvoo</option>
-<option value="posio">Posio</option>
-<option value="pudasjarvi">Pudasj\xe4rvi</option>
-<option value="pukkila">Pukkila</option>
-<option value="punkaharju">Punkaharju</option>
-<option value="punkalaidun">Punkalaidun</option>
-<option value="puolanka">Puolanka</option>
-<option value="puumala">Puumala</option>
-<option value="pyhtaa">Pyht\xe4\xe4</option>
-<option value="pyhajoki">Pyh\xe4joki</option>
-<option value="pyhajarvi">Pyh\xe4j\xe4rvi</option>
-<option value="pyhanta">Pyh\xe4nt\xe4</option>
-<option value="pyharanta">Pyh\xe4ranta</option>
-<option value="palkane">P\xe4lk\xe4ne</option>
-<option value="poytya">P\xf6yty\xe4</option>
-<option value="raahe">Raahe</option>
-<option value="raasepori">Raasepori</option>
-<option value="raisio">Raisio</option>
-<option value="rantasalmi">Rantasalmi</option>
-<option value="ranua">Ranua</option>
-<option value="rauma">Rauma</option>
-<option value="rautalampi">Rautalampi</option>
-<option value="rautavaara">Rautavaara</option>
-<option value="rautjarvi">Rautj\xe4rvi</option>
-<option value="reisjarvi">Reisj\xe4rvi</option>
-<option value="riihimaki">Riihim\xe4ki</option>
-<option value="ristiina">Ristiina</option>
-<option value="ristijarvi">Ristij\xe4rvi</option>
-<option value="rovaniemi">Rovaniemi</option>
-<option value="ruokolahti">Ruokolahti</option>
-<option value="ruovesi">Ruovesi</option>
-<option value="rusko">Rusko</option>
-<option value="raakkyla">R\xe4\xe4kkyl\xe4</option>
-<option value="saarijarvi">Saarij\xe4rvi</option>
-<option value="salla">Salla</option>
-<option value="salo">Salo</option>
-<option value="saltvik">Saltvik</option>
-<option value="sastamala">Sastamala</option>
-<option value="sauvo">Sauvo</option>
-<option value="savitaipale">Savitaipale</option>
-<option value="savonlinna">Savonlinna</option>
-<option value="savukoski">Savukoski</option>
-<option value="seinajoki">Sein\xe4joki</option>
-<option value="sievi">Sievi</option>
-<option value="siikainen">Siikainen</option>
-<option value="siikajoki">Siikajoki</option>
-<option value="siikalatva">Siikalatva</option>
-<option value="siilinjarvi">Siilinj\xe4rvi</option>
-<option value="simo">Simo</option>
-<option value="sipoo">Sipoo</option>
-<option value="siuntio">Siuntio</option>
-<option value="sodankyla">Sodankyl\xe4</option>
-<option value="soini">Soini</option>
-<option value="somero">Somero</option>
-<option value="sonkajarvi">Sonkaj\xe4rvi</option>
-<option value="sotkamo">Sotkamo</option>
-<option value="sottunga">Sottunga</option>
-<option value="sulkava">Sulkava</option>
-<option value="sund">Sund</option>
-<option value="suomenniemi">Suomenniemi</option>
-<option value="suomussalmi">Suomussalmi</option>
-<option value="suonenjoki">Suonenjoki</option>
-<option value="sysma">Sysm\xe4</option>
-<option value="sakyla">S\xe4kyl\xe4</option>
-<option value="taipalsaari">Taipalsaari</option>
-<option value="taivalkoski">Taivalkoski</option>
-<option value="taivassalo">Taivassalo</option>
-<option value="tammela">Tammela</option>
-<option value="tampere">Tampere</option>
-<option value="tarvasjoki">Tarvasjoki</option>
-<option value="tervo">Tervo</option>
-<option value="tervola">Tervola</option>
-<option value="teuva">Teuva</option>
-<option value="tohmajarvi">Tohmaj\xe4rvi</option>
-<option value="toholampi">Toholampi</option>
-<option value="toivakka">Toivakka</option>
-<option value="tornio">Tornio</option>
-<option value="turku" selected="selected">Turku</option>
-<option value="tuusniemi">Tuusniemi</option>
-<option value="tuusula">Tuusula</option>
-<option value="tyrnava">Tyrn\xe4v\xe4</option>
-<option value="toysa">T\xf6ys\xe4</option>
-<option value="ulvila">Ulvila</option>
-<option value="urjala">Urjala</option>
-<option value="utajarvi">Utaj\xe4rvi</option>
-<option value="utsjoki">Utsjoki</option>
-<option value="uurainen">Uurainen</option>
-<option value="uusikaarlepyy">Uusikaarlepyy</option>
-<option value="uusikaupunki">Uusikaupunki</option>
-<option value="vaala">Vaala</option>
-<option value="vaasa">Vaasa</option>
-<option value="valkeakoski">Valkeakoski</option>
-<option value="valtimo">Valtimo</option>
-<option value="vantaa">Vantaa</option>
-<option value="varkaus">Varkaus</option>
-<option value="varpaisjarvi">Varpaisj\xe4rvi</option>
-<option value="vehmaa">Vehmaa</option>
-<option value="vesanto">Vesanto</option>
-<option value="vesilahti">Vesilahti</option>
-<option value="veteli">Veteli</option>
-<option value="vierema">Vierem\xe4</option>
-<option value="vihanti">Vihanti</option>
-<option value="vihti">Vihti</option>
-<option value="viitasaari">Viitasaari</option>
-<option value="vimpeli">Vimpeli</option>
-<option value="virolahti">Virolahti</option>
-<option value="virrat">Virrat</option>
-<option value="vardo">V\xe5rd\xf6</option>
-<option value="vahakyro">V\xe4h\xe4kyr\xf6</option>
-<option value="voyri-maksamaa">V\xf6yri-Maksamaa</option>
-<option value="yli-ii">Yli-Ii</option>
-<option value="ylitornio">Ylitornio</option>
-<option value="ylivieska">Ylivieska</option>
-<option value="ylojarvi">Yl\xf6j\xe4rvi</option>
-<option value="ypaja">Yp\xe4j\xe4</option>
-<option value="ahtari">\xc4ht\xe4ri</option>
-<option value="aanekoski">\xc4\xe4nekoski</option>
-</select>'''
- self.assertHTMLEqual(f.render('municipalities', 'turku'), out)
-
- def test_FIZipCodeField(self):
- error_format = ['Enter a zip code in the format XXXXX.']
- valid = {
- '20540': '20540',
- '20101': '20101',
- }
- invalid = {
- '20s40': error_format,
- '205401': error_format
- }
- self.assertFieldOutput(FIZipCodeField, valid, invalid)
-
- def test_FISocialSecurityNumber(self):
- error_invalid = ['Enter a valid Finnish social security number.']
- valid = {
- '010101-0101': '010101-0101',
- '010101+0101': '010101+0101',
- '010101A0101': '010101A0101',
- }
- invalid = {
- '101010-0102': error_invalid,
- '10a010-0101': error_invalid,
- '101010-0\xe401': error_invalid,
- '101010b0101': error_invalid,
- }
- self.assertFieldOutput(FISocialSecurityNumber, valid, invalid)
View
0  tests/regressiontests/localflavor/fr/__init__.py
No changes.
View
152 tests/regressiontests/localflavor/fr/tests.py
@@ -1,152 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.fr.forms import (FRZipCodeField,
- FRPhoneNumberField, FRDepartmentSelect)
-
-from django.test import SimpleTestCase
-
-
-class FRLocalFlavorTests(SimpleTestCase):
- def test_FRZipCodeField(self):
- error_format = ['Enter a zip code in the format XXXXX.']
- valid = {
- '75001': '75001',
- '93200': '93200',
- }
- invalid = {
- '2A200': error_format,
- '980001': ['Ensure this value has at most 5 characters (it has 6).'
- ] + error_format,
- }
- self.assertFieldOutput(FRZipCodeField, valid, invalid)
-
- def test_FRPhoneNumberField(self):
- error_format = ['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 = '''<select name="dep">
-<option value="01">01 - Ain</option>
-<option value="02">02 - Aisne</option>
-<option value="03">03 - Allier</option>
-<option value="04">04 - Alpes-de-Haute-Provence</option>
-<option value="05">05 - Hautes-Alpes</option>
-<option value="06">06 - Alpes-Maritimes</option>
-<option value="07">07 - Ardèche</option>
-<option value="08">08 - Ardennes</option>
-<option value="09">09 - Ariège</option>
-<option value="10">10 - Aube</option>
-<option value="11">11 - Aude</option>
-<option value="12">12 - Aveyron</option>
-<option value="13">13 - Bouches-du-Rhône</option>
-<option value="14">14 - Calvados</option>
-<option value="15">15 - Cantal</option>
-<option value="16">16 - Charente</option>
-<option value="17">17 - Charente-Maritime</option>
-<option value="18">18 - Cher</option>
-<option value="19">19 - Corrèze</option>
-<option value="2A">2A - Corse-du-Sud</option>
-<option value="2B">2B - Haute-Corse</option>
-<option value="21">21 - Côte-d&#39;Or</option>
-<option value="22">22 - Côtes-d&#39;Armor</option>
-<option value="23">23 - Creuse</option>
-<option value="24">24 - Dordogne</option>
-<option value="25">25 - Doubs</option>
-<option value="26">26 - Drôme</option>
-<option value="27">27 - Eure</option>
-<option value="28">28 - Eure-et-Loir</option>
-<option value="29">29 - Finistère</option>
-<option value="30">30 - Gard</option>
-<option value="31">31 - Haute-Garonne</option>
-<option value="32">32 - Gers</option>
-<option value="33">33 - Gironde</option>
-<option value="34">34 - Hérault</option>
-<option value="35">35 - Ille-et-Vilaine</option>
-<option value="36">36 - Indre</option>
-<option value="37">37 - Indre-et-Loire</option>
-<option value="38">38 - Isère</option>
-<option value="39">39 - Jura</option>
-<option value="40">40 - Landes</option>
-<option value="41">41 - Loir-et-Cher</option>
-<option value="42">42 - Loire</option>
-<option value="43">43 - Haute-Loire</option>
-<option value="44">44 - Loire-Atlantique</option>
-<option value="45">45 - Loiret</option>
-<option value="46">46 - Lot</option>
-<option value="47">47 - Lot-et-Garonne</option>
-<option value="48">48 - Lozère</option>
-<option value="49">49 - Maine-et-Loire</option>
-<option value="50">50 - Manche</option>
-<option value="51">51 - Marne</option>
-<option value="52">52 - Haute-Marne</option>
-<option value="53">53 - Mayenne</option>
-<option value="54">54 - Meurthe-et-Moselle</option>
-<option value="55">55 - Meuse</option>
-<option value="56">56 - Morbihan</option>
-<option value="57">57 - Moselle</option>
-<option value="58">58 - Nièvre</option>
-<option value="59">59 - Nord</option>
-<option value="60">60 - Oise</option>
-<option value="61">61 - Orne</option>
-<option value="62">62 - Pas-de-Calais</option>
-<option value="63">63 - Puy-de-Dôme</option>
-<option value="64">64 - Pyrénées-Atlantiques</option>
-<option value="65">65 - Hautes-Pyrénées</option>
-<option value="66">66 - Pyrénées-Orientales</option>
-<option value="67">67 - Bas-Rhin</option>
-<option value="68">68 - Haut-Rhin</option>
-<option value="69">69 - Rhône</option>
-<option value="70">70 - Haute-Saône</option>
-<option value="71">71 - Saône-et-Loire</option>
-<option value="72">72 - Sarthe</option>
-<option value="73">73 - Savoie</option>
-<option value="74">74 - Haute-Savoie</option>
-<option value="75" selected="selected">75 - Paris</option>
-<option value="76">76 - Seine-Maritime</option>
-<option value="77">77 - Seine-et-Marne</option>
-<option value="78">78 - Yvelines</option>
-<option value="79">79 - Deux-Sèvres</option>
-<option value="80">80 - Somme</option>
-<option value="81">81 - Tarn</option>
-<option value="82">82 - Tarn-et-Garonne</option>
-<option value="83">83 - Var</option>
-<option value="84">84 - Vaucluse</option>
-<option value="85">85 - Vendée</option>
-<option value="86">86 - Vienne</option>
-<option value="87">87 - Haute-Vienne</option>
-<option value="88">88 - Vosges</option>
-<option value="89">89 - Yonne</option>
-<option value="90">90 - Territoire de Belfort</option>
-<option value="91">91 - Essonne</option>
-<option value="92">92 - Hauts-de-Seine</option>
-<option value="93">93 - Seine-Saint-Denis</option>
-<option value="94">94 - Val-de-Marne</option>
-<option value="95">95 - Val-d&#39;Oise</option>
-<option value="971">971 - Guadeloupe</option>
-<option value="972">972 - Martinique</option>
-<option value="973">973 - Guyane</option>
-<option value="974">974 - La Réunion</option>
-<option value="975">975 - Saint-Pierre-et-Miquelon</option>
-<option value="976">976 - Mayotte</option>
-<option value="977">977 - Saint-Barthélemy</option>
-<option value="978">978 - Saint-Martin</option>
-<option value="984">984 - Terres australes et antarctiques françaises</option>
-<option value="986">986 - Wallis et Futuna</option>
-<option value="987">987 - Polynésie française</option>
-<option value="988">988 - Nouvelle-Calédonie</option>
-<option value="989">989 - Île de Clipperton</option>
-</select>'''
- self.assertHTMLEqual(f.render('dep', '75'), out)
View
0  tests/regressiontests/localflavor/gb/__init__.py
No changes.
View
32 tests/regressiontests/localflavor/gb/tests.py
@@ -1,32 +0,0 @@
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.gb.forms import GBPostcodeField
-
-from django.test import SimpleTestCase
-
-
-class GBLocalFlavorTests(SimpleTestCase):
- def test_GBPostcodeField(self):
- error_invalid = ['Enter a valid postcode.']
- valid = {
- 'BT32 4PX': 'BT32 4PX',
- 'GIR 0AA': 'GIR 0AA',
- 'BT324PX': 'BT32 4PX',
- ' so11aa ': 'SO1 1AA',
- ' so1 1aa ': 'SO1 1AA',
- 'G2 3wt': 'G2 3WT',
- 'EC1A 1BB': 'EC1A 1BB',
- 'Ec1a1BB': 'EC1A 1BB',
- }
- invalid = {
- '1NV 4L1D': error_invalid,
- '1NV4L1D': error_invalid,
- ' b0gUS': error_invalid,
- }
- self.assertFieldOutput(GBPostcodeField, valid, invalid)
- valid = {}
- invalid = {
- '1NV 4L1D': ['Enter a bloody postcode!'],
- }
- kwargs = {'error_messages': {'invalid': 'Enter a bloody postcode!'}}
- self.assertFieldOutput(GBPostcodeField, valid, invalid, field_kwargs=kwargs)
View
0  tests/regressiontests/localflavor/hk/__init__.py
No changes.
View
11 tests/regressiontests/localflavor/hk/forms.py
@@ -1,11 +0,0 @@
-from __future__ import absolute_import
-
-from django.forms import ModelForm
-
-from .models import HKPlace
-
-
-class HKPlaceForm(ModelForm):
-
- class Meta:
- model = HKPlace
View
35 tests/regressiontests/localflavor/hk/tests.py
@@ -1,35 +0,0 @@
-from __future__ import absolute_import
-
-from django.contrib.localflavor.hk.forms import HKPhoneNumberField
-from django.test import SimpleTestCase
-
-
-class HKLocalFlavorTests(SimpleTestCase):
- """Tests for Hong Kong Local Flavors"""
-
- def test_HKPhoneNumberField(self):
- error_msgs = HKPhoneNumberField.default_error_messages
- valid = {
- '2111-1111': '2111-1111',
- '3111 1111': '3111-1111',
- '51111111': '5111-1111',
- '852-6111-1111': '6111-1111',
- '(+852) 8111-1111': '8111-1111',
- '(+852) 9111-1111': '9111-1111',
- '85291111111': '9111-1111',
- }
- invalid = {
- '9991-1111': [error_msgs['disguise'], ],
- '9921-1111': [error_msgs['disguise'], ],
- '1121-1111': [error_msgs['disguise'], ],
- '99987654': [error_msgs['disguise'], ],
- '99287654': [error_msgs['disguise'], ],
- '11287654': [error_msgs['disguise'], ],
- '1': [error_msgs['invalid'], ],
- '2111--1111': [error_msgs['invalid'], ],
- '11111111': [error_msgs['prefix'], ],
- '00000000': [error_msgs['prefix'], ],
- '44444444': [error_msgs['prefix'], ],
- '77777777': [error_msgs['prefix'], ],
- }
- self.assertFieldOutput(HKPhoneNumberField, valid, invalid)
View
0  tests/regressiontests/localflavor/hr/__init__.py
No changes.
View
192 tests/regressiontests/localflavor/hr/tests.py
@@ -1,192 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.contrib.localflavor.hr.forms import (HRCountySelect,
- HRPhoneNumberPrefixSelect, HRLicensePlatePrefixSelect, HRPhoneNumberField,
- HRLicensePlateField, HRPostalCodeField, HROIBField, HRJMBGField,
- HRJMBAGField)
-
-from django.test import SimpleTestCase
-
-class HRLocalFlavorTests(SimpleTestCase):
- def test_HRCountySelect(self):
- f = HRCountySelect()
- out = '''<select name="county">
-<option value="GZG" selected="selected">Grad Zagreb</option>
-<option value="BBŽ">Bjelovarsko-bilogorska županija</option>
-<option value="BPŽ">Brodsko-posavska županija</option>
-<option value="DNŽ">Dubrovačko-neretvanska županija</option>
-<option value="IŽ">Istarska županija</option>
-<option value="KŽ">Karlovačka županija</option>
-<option value="KKŽ">Koprivničko-križevačka županija</option>
-<option value="KZŽ">Krapinsko-zagorska županija</option>
-<option value="LSŽ">Ličko-senjska županija</option>
-<option value="MŽ">Međimurska županija</option>
-<option value="OBŽ">Osječko-baranjska županija</option>
-<option value="PSŽ">Požeško-slavonska županija</option>
-<option value="PGŽ">Primorsko-goranska županija</option>
-<option value="SMŽ">Sisačko-moslavačka županija</option>
-<option value="SDŽ">Splitsko-dalmatinska županija</option>
-<option value="ŠKŽ">Šibensko-kninska županija</option>
-<option value="VŽ">Varaždinska županija</option>
-<option value="VPŽ">Virovitičko-podravska županija</option>
-<option value="VSŽ">Vukovarsko-srijemska županija</option>
-<option value="ZDŽ">Zadarska županija</option>
-<option value="ZGŽ">Zagrebačka županija</option>
-</select>'''
- self.assertHTMLEqual(f.render('county', 'GZG'), out)
-
- def test_HRPhoneNumberPrefixSelect(self):
- f = HRPhoneNumberPrefixSelect()
- out = '''<select name="phone">
-<option value="1" selected="selected">01</option>
-<option value="20">020</option>
-<option value="21">021</option>
-<option value="22">022</option>
-<option value="23">023</option>
-<option value="31">031</option>
-<option value="32">032</option>
-<option value="33">033</option>
-<option value="34">034</option>
-<option value="35">035</option>
-<option value="40">040</option>
-<option value="42">042</option>
-<option value="43">043</option>
-<option value="44">044</option>
-<option value="47">047</option>
-<option value="48">048</option>
-<option value="49">049</option>
-<option value="51">051</option>
-<option value="52">052</option>
-<option value="53">053</option>
-<option value="91">091</option>
-<option value="92">092</option>
-<option value="95">095</option>
-<option value="97">097</option>
-<option value="98">098</option>
-<option value="99">099</option>
-</select>'''
- self.assertHTMLEqual(f.render('phone', '1'), out)
-
- def test_HRLicensePlatePrefixSelect(self):
- f = HRLicensePlatePrefixSelect()
- out = '''<select name="license">
-<option value="BJ" selected="selected">BJ</option>
-<option value="BM">BM</option>
-<option value="ČK">ČK</option>
-<option value="DA">DA</option>
-<option value="DE">DE</option>
-<option value="DJ">DJ</option>
-<option value="DU">DU</option>
-<option value="GS">GS</option>
-<option value="IM">IM</option>
-<option value="KA">KA</option>
-<option value="KC">KC</option>
-<option value="KR">KR</option>
-<option value="KT">KT</option>
-<option value="KŽ">KŽ</option>
-<option value="MA">MA</option>
-<option value="NA">NA</option>
-<option value="NG">NG</option>
-<option value="OG">OG</option>
-<option value="OS">OS</option>
-<option value="PU">PU</option>
-<option value="PŽ">PŽ</option>
-<option value="RI">RI</option>
-<option value="SB">SB</option>
-<option value="SK">SK</option>
-<option value="SL">SL</option>
-<option value="ST">ST</option>
-<option value="ŠI">ŠI</option>
-<option value="VK">VK</option>
-<option value="VT">VT</option>
-<option value="VU">VU</option>
-<option value="VŽ">VŽ</option>
-<option value="ZD">ZD</option>
-<option value="ZG">ZG</option>
-<option value="ŽU">ŽU</option>
-</select>'''
- self.assertHTMLEqual(f.render('license', 'BJ'), out)
-
- def test_HRPhoneNumberField(self):
- error_invalid = ['Enter a valid phone number']
- error_area = ['Enter a valid area or mobile network code']
- error_number = ['The phone nubmer is too long']
- valid = {
- '+38511234567': '+38511234567',
- '0038511234567': '+38511234567',
- '011234567': '+38511234567',
- '+38521123456': '+38521123456',
- '0038521123456': '+38521123456',
- '021123456': '+38521123456',
- }
- invalid = {
- '123456789': error_invalid,
- '0811234567': error_area,
- '0111234567': error_number,
- }
- self.assertFieldOutput(HRPhoneNumberField, valid, invalid)
-
- def test_HRLicensePlateField(self):
- error_invalid = ['Enter a valid vehicle license plate number']
- error_area = ['Enter a valid location code']
- error_number = ['Number part cannot be zero']
- valid = {
- 'ZG 1234-AA': 'ZG 1234-AA',
- 'ZG 123-A': 'ZG 123-A',
- }
- invalid = {
- 'PV12345': error_invalid,
- 'PV1234AA': error_area,
- 'ZG0000CC': error_number,
- }
- self.assertFieldOutput(HRLicensePlateField, valid, invalid)
-
- def test_HRPostalCodeField(self):
- error_invalid = ['Enter a valid 5 digit postal code']
- valid = {
- '10000': '10000',
- '35410': '35410',
- }
- invalid = {
- 'ABCD': error_invalid,
- '99999': error_invalid,
- }
- self.assertFieldOutput(HRPostalCodeField, valid, invalid)
-
- def test_HROIBField(self):
- error_invalid = ['Enter a valid 11 digit OIB']
- valid = {
- '12345678901': '12345678901',
- }
- invalid = {
- '1234567890': ['Ensure this value has at least 11 characters (it has 10).'] + error_invalid,
- 'ABCDEFGHIJK': error_invalid,
- }
- self.assertFieldOutput(HROIBField, valid, invalid)
-
- def test_HRJMBGField(self):
- error_invalid = ['Enter a valid 13 digit JMBG']
- error_date = ['Error in date segment']
- valid = {
- '1211984302155': '1211984302155',
- '2701984307107': '2701984307107',
- }
- invalid = {
- '1211984302156': error_invalid,
- 'ABCDEFG': error_invalid,
- '9999999123456': error_date,
- }
- self.assertFieldOutput(HRJMBGField, valid, invalid)
-
- def test_HRJMBAGField(self):
- error_invalid = ['Enter a valid 19 digit JMBAG starting with 601983']
- error_copy = ['Card issue number cannot be zero']
- valid = {
- '601983 11 0130185856 4': '6019831101301858564