Permalink
Browse files

Removed country-specific localflavor tests.

They now live in separate django-contrib-XX packages.
  • Loading branch information...
1 parent 24c7d82 commit ffbc599f77120674cd16e6dcac2f22998c84e407 @adrianholovaty adrianholovaty committed Oct 12, 2012
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
@@ -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)
@@ -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)
@@ -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
@@ -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'
@@ -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)
@@ -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)
Oops, something went wrong.

0 comments on commit ffbc599

Please sign in to comment.