Permalink
Browse files

Fixed #15837. Consolidated all the locaflavor tests into a single, lo…

…gical, place (regressiontests/localflavor/).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16680 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent ec1226b commit a3fd9cf288e71b9c8e5fb6479eda3d33bc0a9d65 @jphalip jphalip committed Aug 24, 2011
Showing with 483 additions and 554 deletions.
  1. +0 −1 tests/regressiontests/forms/localflavor/__init__.py
  2. +0 −50 tests/regressiontests/forms/localflavor/au.py
  3. +0 −131 tests/regressiontests/forms/localflavor/mk.py
  4. +0 −127 tests/regressiontests/forms/localflavor/mx.py
  5. +0 −129 tests/regressiontests/forms/localflavor/us.py
  6. +0 −42 tests/regressiontests/forms/localflavortests.py
  7. +0 −44 tests/regressiontests/forms/tests/__init__.py
  8. 0 tests/regressiontests/localflavor/ar/__init__.py
  9. 0 tests/regressiontests/{forms/localflavor/ar.py → localflavor/ar/tests.py}
  10. 0 tests/regressiontests/localflavor/at/__init__.py
  11. 0 tests/regressiontests/{forms/localflavor/at.py → localflavor/at/tests.py}
  12. +49 −2 tests/regressiontests/localflavor/au/tests.py
  13. 0 tests/regressiontests/localflavor/be/__init__.py
  14. 0 tests/regressiontests/{forms/localflavor/be.py → localflavor/be/tests.py}
  15. 0 tests/regressiontests/localflavor/br/__init__.py
  16. 0 tests/regressiontests/{forms/localflavor/br.py → localflavor/br/tests.py}
  17. 0 tests/regressiontests/localflavor/ca/__init__.py
  18. 0 tests/regressiontests/{forms/localflavor/ca.py → localflavor/ca/tests.py}
  19. 0 tests/regressiontests/localflavor/ch/__init__.py
  20. +3 −4 tests/regressiontests/{forms/localflavor/ch.py → localflavor/ch/tests.py}
  21. 0 tests/regressiontests/localflavor/cl/__init__.py
  22. 0 tests/regressiontests/{forms/localflavor/cl.py → localflavor/cl/tests.py}
  23. 0 tests/regressiontests/localflavor/cn/__init__.py
  24. +0 −1 tests/regressiontests/{forms/localflavor/cn.py → localflavor/cn/tests.py}
  25. 0 tests/regressiontests/localflavor/co/__init__.py
  26. 0 tests/regressiontests/{forms/localflavor/co.py → localflavor/co/tests.py}
  27. 0 tests/regressiontests/localflavor/cz/__init__.py
  28. 0 tests/regressiontests/{forms/localflavor/cz.py → localflavor/cz/tests.py}
  29. 0 tests/regressiontests/localflavor/de/__init__.py
  30. 0 tests/regressiontests/{forms/localflavor/de.py → localflavor/de/tests.py}
  31. 0 tests/regressiontests/localflavor/ec/__init__.py
  32. 0 tests/regressiontests/{forms/localflavor/ec.py → localflavor/ec/tests.py}
  33. 0 tests/regressiontests/localflavor/es/__init__.py
  34. +1 −3 tests/regressiontests/{forms/localflavor/es.py → localflavor/es/tests.py}
  35. 0 tests/regressiontests/localflavor/fi/__init__.py
  36. +0 −1 tests/regressiontests/{forms/localflavor/fi.py → localflavor/fi/tests.py}
  37. 0 tests/regressiontests/localflavor/fr/__init__.py
  38. 0 tests/regressiontests/{forms/localflavor/fr.py → localflavor/fr/tests.py}
  39. 0 tests/regressiontests/localflavor/gb/__init__.py
  40. 0 tests/regressiontests/{forms/localflavor/gb.py → localflavor/gb/tests.py}
  41. 0 tests/regressiontests/localflavor/generic/__init__.py
  42. 0 tests/regressiontests/{forms/localflavor/generic.py → localflavor/generic/tests.py}
  43. 0 tests/regressiontests/localflavor/hr/__init__.py
  44. 0 tests/regressiontests/{forms/localflavor/hr.py → localflavor/hr/tests.py}
  45. 0 tests/regressiontests/localflavor/id/__init__.py
  46. 0 tests/regressiontests/{forms/localflavor/id.py → localflavor/id/tests.py}
  47. 0 tests/regressiontests/localflavor/ie/__init__.py
  48. 0 tests/regressiontests/{forms/localflavor/ie.py → localflavor/ie/tests.py}
  49. 0 tests/regressiontests/localflavor/il/__init__.py
  50. 0 tests/regressiontests/{forms/localflavor/il.py → localflavor/il/tests.py}
  51. 0 tests/regressiontests/localflavor/in_/__init__.py
  52. 0 tests/regressiontests/{forms/localflavor/in_.py → localflavor/in_/tests.py}
  53. 0 tests/regressiontests/localflavor/is_/__init__.py
  54. +3 −4 tests/regressiontests/{forms/localflavor/is_.py → localflavor/is_/tests.py}
  55. 0 tests/regressiontests/localflavor/it/__init__.py
  56. +2 −3 tests/regressiontests/{forms/localflavor/it.py → localflavor/it/tests.py}
  57. 0 tests/regressiontests/localflavor/jp/__init__.py
  58. 0 tests/regressiontests/{forms/localflavor/jp.py → localflavor/jp/tests.py}
  59. 0 tests/regressiontests/localflavor/kw/__init__.py
  60. +0 −1 tests/regressiontests/{forms/localflavor/kw.py → localflavor/kw/tests.py}
  61. +130 −2 tests/regressiontests/localflavor/mk/tests.py
  62. 0 tests/regressiontests/localflavor/mx/mx.py
  63. +126 −2 tests/regressiontests/localflavor/mx/tests.py
  64. 0 tests/regressiontests/localflavor/nl/__init__.py
  65. 0 tests/regressiontests/{forms/localflavor/nl.py → localflavor/nl/tests.py}
  66. 0 tests/regressiontests/localflavor/pl/__init__.py
  67. 0 tests/regressiontests/{forms/localflavor/pl.py → localflavor/pl/tests.py}
  68. 0 tests/regressiontests/localflavor/pt/__init__.py
  69. 0 tests/regressiontests/{forms/localflavor/pt.py → localflavor/pt/tests.py}
  70. 0 tests/regressiontests/localflavor/py/__init__.py
  71. 0 tests/regressiontests/{forms/localflavor/py.py → localflavor/py/tests.py}
  72. 0 tests/regressiontests/localflavor/ro/__init__.py
  73. 0 tests/regressiontests/{forms/localflavor/ro.py → localflavor/ro/tests.py}
  74. 0 tests/regressiontests/localflavor/ru/__init__.py
  75. +1 −1 tests/regressiontests/{forms/localflavor/ru.py → localflavor/ru/tests.py}
  76. 0 tests/regressiontests/localflavor/se/__init__.py
  77. +0 −1 tests/regressiontests/{forms/localflavor/se.py → localflavor/se/tests.py}
  78. 0 tests/regressiontests/localflavor/sk/__init__.py
  79. 0 tests/regressiontests/{forms/localflavor/sk.py → localflavor/sk/tests.py}
  80. +37 −1 tests/regressiontests/localflavor/tests.py
  81. 0 tests/regressiontests/localflavor/tr/__init__.py
  82. 0 tests/regressiontests/{forms/localflavor/tr.py → localflavor/tr/tests.py}
  83. +130 −2 tests/regressiontests/localflavor/us/tests.py
  84. 0 tests/regressiontests/localflavor/uy/__init__.py
  85. +1 −2 tests/regressiontests/{forms/localflavor/uy.py → localflavor/uy/tests.py}
  86. 0 tests/regressiontests/localflavor/za/__init__.py
  87. 0 tests/regressiontests/{forms/localflavor/za.py → localflavor/za/tests.py}
@@ -1,50 +0,0 @@
-from django.contrib.localflavor.au.forms import (AUPostCodeField,
- AUPhoneNumberField, AUStateSelect)
-
-from django.test import SimpleTestCase
-
-
-class AULocalFlavorTests(SimpleTestCase):
- def test_AUStateSelect(self):
- f = AUStateSelect()
- out = u'''<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.assertEqual(f.render('state', 'NSW'), out)
-
- def test_AUPostCodeField(self):
- error_format = [u'Enter a 4 digit postcode.']
- valid = {
- '1234': '1234',
- '2000': '2000',
- }
- invalid = {
- 'abcd': error_format,
- '20001': [u'Ensure this value has at most 4 characters (it has 5).'] + error_format,
- }
- self.assertFieldOutput(AUPostCodeField, valid, invalid)
-
- def test_AUPhoneNumberField(self):
- error_format = [u'Phone numbers must contain 10 digits.']
- valid = {
- '1234567890': '1234567890',
- '0213456789': '0213456789',
- '02 13 45 67 89': '0213456789',
- '(02) 1345 6789': '0213456789',
- '(02) 1345-6789': '0213456789',
- '(02)1345-6789': '0213456789',
- '0408 123 456': '0408123456',
- }
- invalid = {
- '123': error_format,
- '1800DJANGO': error_format,
- }
- self.assertFieldOutput(AUPhoneNumberField, valid, invalid)
-
@@ -1,131 +0,0 @@
-from django.contrib.localflavor.mk.forms import (
- MKIdentityCardNumberField, MKMunicipalitySelect, UMCNField)
-
-from django.test import SimpleTestCase
-
-
-class MKLocalFlavorTests(SimpleTestCase):
-
- def test_MKIdentityCardNumberField(self):
- error_invalid = [u'Identity card numbers must contain either 4 to 7 '
- 'digits or an uppercase letter and 7 digits.']
- valid = {
- 'L0018077':'L0018077',
- 'A0078315' : 'A0078315',
- }
- invalid = {
- '123': error_invalid,
- 'abcdf': error_invalid,
- '234390a': error_invalid,
- }
- self.assertFieldOutput(MKIdentityCardNumberField, valid, invalid)
-
- def test_MKMunicipalitySelect(self):
- f = MKMunicipalitySelect()
- out=u'''<select name="municipality">
-<option value="AD">Aerodrom</option>
-<option value="AR">Ara\u010dinovo</option>
-<option value="BR">Berovo</option>
-<option value="TL">Bitola</option>
-<option value="BG">Bogdanci</option>
-<option value="VJ">Bogovinje</option>
-<option value="BS">Bosilovo</option>
-<option value="BN">Brvenica</option>
-<option value="BU">Butel</option>
-<option value="VA">Valandovo</option>
-<option value="VL">Vasilevo</option>
-<option value="VV">Vev\u010dani</option>
-<option value="VE">Veles</option>
-<option value="NI">Vinica</option>
-<option value="VC">Vrane\u0161tica</option>
-<option value="VH">Vrap\u010di\u0161te</option>
-<option value="GB">Gazi Baba</option>
-<option value="GV">Gevgelija</option>
-<option value="GT">Gostivar</option>
-<option value="GR">Gradsko</option>
-<option value="DB">Debar</option>
-<option value="DA">Debarca</option>
-<option value="DL" selected="selected">Del\u010devo</option>
-<option value="DK">Demir Kapija</option>
-<option value="DM">Demir Hisar</option>
-<option value="DE">Dolneni</option>
-<option value="DR">Drugovo</option>
-<option value="GP">Gjor\u010de Petrov</option>
-<option value="ZE">\u017delino</option>
-<option value="ZA">Zajas</option>
-<option value="ZK">Zelenikovo</option>
-<option value="ZR">Zrnovci</option>
-<option value="IL">Ilinden</option>
-<option value="JG">Jegunovce</option>
-<option value="AV">Kavadarci</option>
-<option value="KB">Karbinci</option>
-<option value="KX">Karpo\u0161</option>
-<option value="VD">Kisela Voda</option>
-<option value="KH">Ki\u010devo</option>
-<option value="KN">Kon\u010de</option>
-<option value="OC">Ko\u0107ani</option>
-<option value="KY">Kratovo</option>
-<option value="KZ">Kriva Palanka</option>
-<option value="KG">Krivoga\u0161tani</option>
-<option value="KS">Kru\u0161evo</option>
-<option value="UM">Kumanovo</option>
-<option value="LI">Lipkovo</option>
-<option value="LO">Lozovo</option>
-<option value="MR">Mavrovo i Rostu\u0161a</option>
-<option value="MK">Makedonska Kamenica</option>
-<option value="MD">Makedonski Brod</option>
-<option value="MG">Mogila</option>
-<option value="NG">Negotino</option>
-<option value="NV">Novaci</option>
-<option value="NS">Novo Selo</option>
-<option value="OS">Oslomej</option>
-<option value="OD">Ohrid</option>
-<option value="PE">Petrovec</option>
-<option value="PH">Peh\u010devo</option>
-<option value="PN">Plasnica</option>
-<option value="PP">Prilep</option>
-<option value="PT">Probi\u0161tip</option>
-<option value="RV">Radovi\u0161</option>
-<option value="RN">Rankovce</option>
-<option value="RE">Resen</option>
-<option value="RO">Rosoman</option>
-<option value="AJ">Saraj</option>
-<option value="SL">Sveti Nikole</option>
-<option value="SS">Sopi\u0161te</option>
-<option value="SD">Star Dojran</option>
-<option value="NA">Staro Nagori\u010dane</option>
-<option value="UG">Struga</option>
-<option value="RU">Strumica</option>
-<option value="SU">Studeni\u010dani</option>
-<option value="TR">Tearce</option>
-<option value="ET">Tetovo</option>
-<option value="CE">Centar</option>
-<option value="CZ">Centar-\u017dupa</option>
-<option value="CI">\u010cair</option>
-<option value="CA">\u010ca\u0161ka</option>
-<option value="CH">\u010ce\u0161inovo-Oble\u0161evo</option>
-<option value="CS">\u010cu\u010der-Sandevo</option>
-<option value="ST">\u0160tip</option>
-<option value="SO">\u0160uto Orizari</option>
-</select>'''
- self.assertEqual(f.render('municipality', 'DL' ), out)
-
- def test_UMCNField(self):
- error_invalid = [u'This field should contain exactly 13 digits.']
- error_checksum = [u'The UMCN is not valid.']
- error_date = [u'The first 7 digits of the UMCN '
- 'must represent a valid past date.']
- valid = {
- '2402983450006': '2402983450006',
- '2803984430038': '2803984430038',
- '1909982045004': '1909982045004',
- }
- invalid = {
- '240298345': error_invalid,
- 'abcdefghj': error_invalid,
- '2402082450006': error_date,
- '3002982450006': error_date,
- '2402983450007': error_checksum,
- '2402982450006': error_checksum,
- }
- self.assertFieldOutput(UMCNField, valid, invalid)
@@ -1,127 +0,0 @@
-# -*- coding: utf-8 -*-
-from django.contrib.localflavor.mx.forms import (MXZipCodeField, MXRFCField,
- MXStateSelect, MXCURPField)
-
-from django.test import SimpleTestCase
-
-
-class MXLocalFlavorTests(SimpleTestCase):
- def test_MXStateSelect(self):
- f = MXStateSelect()
- out = u'''<select name="state">
-<option value="AGU">Aguascalientes</option>
-<option value="BCN">Baja California</option>
-<option value="BCS">Baja California Sur</option>
-<option value="CAM">Campeche</option>
-<option value="CHH">Chihuahua</option>
-<option value="CHP">Chiapas</option>
-<option value="COA">Coahuila</option>
-<option value="COL">Colima</option>
-<option value="DIF">Distrito Federal</option>
-<option value="DUR">Durango</option>
-<option value="GRO">Guerrero</option>
-<option value="GUA">Guanajuato</option>
-<option value="HID">Hidalgo</option>
-<option value="JAL">Jalisco</option>
-<option value="MEX">Estado de México</option>
-<option value="MIC" selected="selected">Michoacán</option>
-<option value="MOR">Morelos</option>
-<option value="NAY">Nayarit</option>
-<option value="NLE">Nuevo León</option>
-<option value="OAX">Oaxaca</option>
-<option value="PUE">Puebla</option>
-<option value="QUE">Querétaro</option>
-<option value="ROO">Quintana Roo</option>
-<option value="SIN">Sinaloa</option>
-<option value="SLP">San Luis Potosí</option>
-<option value="SON">Sonora</option>
-<option value="TAB">Tabasco</option>
-<option value="TAM">Tamaulipas</option>
-<option value="TLA">Tlaxcala</option>
-<option value="VER">Veracruz</option>
-<option value="YUC">Yucatán</option>
-<option value="ZAC">Zacatecas</option>
-</select>'''
- self.assertEqual(f.render('state', 'MIC'), out)
-
- def test_MXZipCodeField(self):
- error_format = [u'Enter a valid zip code in the format XXXXX.']
- valid = {
- '58120': u'58120',
- '58502': u'58502',
- '59310': u'59310',
- '99999': u'99999',
- }
- invalid = {
- '17000': error_format,
- '18000': error_format,
- '19000': error_format,
- '00000': error_format,
- }
- self.assertFieldOutput(MXZipCodeField, valid, invalid)
-
- def test_MXRFCField(self):
- error_format = [u'Enter a valid RFC.']
- error_checksum = [u'Invalid checksum for RFC.']
- valid = {
- 'MoFN641205eX5': u'MOFN641205EX5',
- 'ICa060120873': u'ICA060120873',
- 'eUcG751104rT0': u'EUCG751104RT0',
- 'GME08100195A': u'GME08100195A',
- 'AA&060524KX5': u'AA&060524KX5',
- 'CAÑ0708045P7': u'CAÑ0708045P7',
- 'aaa000101aa9': u'AAA000101AA9',
- }
- invalid = {
- 'MED0000000XA': error_format,
- '0000000000XA': error_format,
- 'AAA000000AA6': error_format,
- # Dates
- 'XXX880002XXX': error_format,
- 'XXX880200XXX': error_format,
- 'XXX880132XXX': error_format,
- 'XXX880230XXX': error_format,
- 'XXX880431XXX': error_format,
- # Incorrect checksum
- 'MOGR650524E73': error_checksum,
- 'HVA7810058F1': error_checksum,
- 'MoFN641205eX2': error_checksum,
- 'ICa060120871': error_checksum,
- 'eUcG751104rT7': error_checksum,
- 'GME081001955': error_checksum,
- 'AA&060524KX9': error_checksum,
- 'CAÑ0708045P2': error_checksum,
- }
- self.assertFieldOutput(MXRFCField, valid, invalid)
-
- def test_MXCURPField(self):
- error_format = [u'Enter a valid CURP.']
- error_checksum = [u'Invalid checksum for CURP.']
- valid = {
- 'AaMG890608HDFLJL00': u'AAMG890608HDFLJL00',
- 'BAAd890419HMNRRV07': u'BAAD890419HMNRRV07',
- 'VIAA900930MMNClL08': u'VIAA900930MMNCLL08',
- 'HEGR891009HMNRRD09': u'HEGR891009HMNRRD09',
- 'MARR890512HMNRMN09': u'MARR890512HMNRMN09',
- 'MESJ890928HMNZNS00': u'MESJ890928HMNZNS00',
- 'BAAA890317HDFRLL03': u'BAAA890317HDFRLL03',
- 'TOMA880125HMNRRNO2': u'TOMA880125HMNRRNO2',
- 'OOMG890727HMNRSR06': u'OOMG890727HMNRSR06',
- 'AAAA000101HDFCCC09': u'AAAA000101HDFCCC09',
- }
- invalid = {
- 'AAAA000000HDFCCC09': error_format,
- 'AAAA000000HDFAAA03': error_format,
- 'AAAA000000HXXCCC08': error_format,
- 'AAAA000000XMNCCC02': error_format,
- 'HEGR891009HMNRRD0A': error_format,
- 'MARR890512HMNRMN0A': error_format,
- 'AaMG890608HDFLJL01': error_checksum,
- 'BAAd890419HMNRRV08': error_checksum,
- 'VIAA900930MMNClL09': error_checksum,
- 'MESJ890928HMNZNS01': error_checksum,
- 'BAAA890317HDFRLL04': error_checksum,
- 'TOMA880125HMNRRNO3': error_checksum,
- 'OOMG890727HMNRSR07': error_checksum,
- }
- self.assertFieldOutput(MXCURPField, valid, invalid)
Oops, something went wrong.

0 comments on commit a3fd9cf

Please sign in to comment.