Ticket #15813: in_states_normalized_path_with_tests.diff
File in_states_normalized_path_with_tests.diff, 4.2 KB (added by , 14 years ago) |
---|
-
tests/regressiontests/localflavor/in_/tests.py
1 from django.test import TestCase 2 from forms import IndiaForm 3 4 class IndiaLocalflavorTests(TestCase): 5 def test_state_field_should_normalize_entry_to_two_letter_abbr(self): 6 form = IndiaForm({'state': 'tamilnad'}) 7 result = form.is_valid() 8 self.assertTrue(result) 9 10 def test_should_normalize_two_letter_abbr(self): 11 form = IndiaForm({'state': 'gj'}) 12 result = form.is_valid() 13 self.assertTrue(result) 14 15 def test_should_normalize_state_name(self): 16 form = IndiaForm({'state': 'gujarat'}) 17 result = form.is_valid() 18 self.assertTrue(result) 19 No newline at end of file -
tests/regressiontests/localflavor/in_/forms.py
1 from django import forms 2 from django.contrib.localflavor.in_.forms import INStateField 3 4 class IndiaForm(forms.Form): 5 state = INStateField() 6 No newline at end of file -
tests/regressiontests/localflavor/tests.py
3 3 4 4 # just import your tests here 5 5 from us.tests import * 6 from in_.tests import * -
django/contrib/localflavor/in_/in_states.py
47 47 ) 48 48 49 49 STATES_NORMALIZED = { 50 'ka': 'KA', 51 'karnatka': 'KA', 52 'tn': 'TN', 53 'tamilnad': 'TN', 54 'tamilnadu': 'TN', 50 'an': 'AN', 51 'andaman and nicobar': 'AN', 55 52 'andra pradesh': 'AP', 56 53 'andrapradesh': 'AP', 57 54 'andhrapradesh': 'AP', 58 'maharastra': 'MH',59 'mh': 'MH',60 55 'ap': 'AP', 56 'andhra pradesh': 'AP', 57 'ar': 'AR', 58 'arunachal pradesh': 'AR', 59 'assam': 'AS', 60 'as': 'AS', 61 'bihar': 'BR', 62 'br': 'BR', 63 'cg': 'CG', 64 'chattisgarh': 'CG', 65 'ch': 'CH', 66 'chandigarh': 'CH', 67 'daman and diu': 'DD', 68 'dd': 'DD', 61 69 'dl': 'DL', 62 'dd': 'DD', 63 'br': 'BR', 64 'ar': 'AR', 65 'sk': 'SK', 66 'kl': 'KL', 70 'delhi': 'DL', 71 'dn': 'DN', 72 'dadra and nagar haveli': 'DN', 67 73 'ga': 'GA', 68 'rj': 'RJ', 69 'rajastan': 'RJ', 70 'rajasthan': 'RJ', 74 'goa': 'GA', 75 'gj': 'GJ', 76 'gujarat': 'GJ', 77 'himachal pradesh': 'HP', 71 78 'hp': 'HP', 72 'ua': 'UA', 73 'up': 'UP', 79 'hr': 'HR', 80 'haryana': 'HR', 81 'jharkhand': 'JH', 82 'jh': 'JH', 83 'jammu and kashmir': 'JK', 84 'jk': 'JK', 85 'karnataka': 'KA', 86 'karnatka': 'KA', 87 'ka': 'KA', 88 'kerala': 'KL', 89 'kl': 'KL', 90 'ld': 'LD', 91 'lakshadweep': 'LD', 92 'maharastra': 'MH', 93 'mh': 'MH', 94 'maharashtra': 'MH', 95 'meghalaya': 'ML', 96 'ml': 'ML', 97 'mn': 'MN', 98 'manipur': 'MN', 99 'madhya pradesh': 'MP', 74 100 'mp': 'MP', 101 'mizoram': 'MZ', 102 'mizo': 'MZ', 75 103 'mz': 'MZ', 76 'bengal': 'WB', 77 'westbengal': 'WB', 78 'mizo': 'MZ', 104 'nl': 'NL', 105 'nagaland': 'NL', 106 'orissa': 'OR', 107 'odisa': 'OR', 79 108 'orisa': 'OR', 80 'odisa': 'OR',81 109 'or': 'OR', 82 'ar': 'AR', 110 'pb': 'PB', 111 'punjab': 'PB', 112 'py': 'PY', 113 'pondicherry': 'PY', 114 'rajasthan': 'RJ', 115 'rajastan': 'RJ', 116 'rj': 'RJ', 117 'sikkim': 'SK', 118 'sk': 'SK', 119 'tamil nadu': 'TN', 120 'tn': 'TN', 121 'tamilnadu': 'TN', 122 'tamilnad': 'TN', 123 'tr': 'TR', 124 'tripura': 'TR', 125 'ua': 'UA', 126 'uttarakhand': 'UA', 127 'up': 'UP', 128 'uttar pradesh': 'UP', 129 'westbengal': 'WB', 130 'bengal': 'WB', 131 'wb': 'WB', 132 'west bengal': 'WB' 83 133 } 84 134