|
26 | 26 | 'bs_BA', 'fr_LU', 'kl_GL', 'fa_IR', 'de_BE', 'sv_SE', 'it_CH', 'uk_UA',
|
27 | 27 | 'eu_ES', 'vi_VN', 'af_ZA', 'nb_NO', 'en_DK', 'tg_TJ', 'ps_AF', 'en_US',
|
28 | 28 | 'fr_FR.ISO8859-1', 'fr_FR.UTF-8', 'fr_FR.ISO8859-15@euro',
|
29 |
| - 'ru_RU.KOI8-R', 'ko_KR.eucKR'] |
| 29 | + 'ru_RU.KOI8-R', 'ko_KR.eucKR', |
| 30 | + 'ja_JP.UTF-8', 'lzh_TW.UTF-8', 'my_MM.UTF-8', 'or_IN.UTF-8', 'shn_MM.UTF-8', |
| 31 | + 'ar_AE.UTF-8', 'bn_IN.UTF-8', 'mr_IN.UTF-8', 'th_TH.TIS620', |
| 32 | +] |
30 | 33 |
|
31 | 34 | def setUpModule():
|
32 | 35 | global candidate_locales
|
@@ -78,11 +81,13 @@ def accept(loc):
|
78 | 81 | 'C': (0, {}),
|
79 | 82 | 'en_US': (0, {}),
|
80 | 83 | 'fa_IR': (100, {0: '\u06f0\u06f0', 10: '\u06f1\u06f0', 99: '\u06f9\u06f9'}),
|
81 |
| - 'ja_JP': (100, {0: '\u3007', 10: '\u5341', 99: '\u4e5d\u5341\u4e5d'}), |
| 84 | + 'ja_JP': (100, {1: '\u4e00', 10: '\u5341', 99: '\u4e5d\u5341\u4e5d'}), |
82 | 85 | 'lzh_TW': (32, {0: '\u3007', 10: '\u5341', 31: '\u5345\u4e00'}),
|
83 | 86 | 'my_MM': (100, {0: '\u1040\u1040', 10: '\u1041\u1040', 99: '\u1049\u1049'}),
|
84 | 87 | 'or_IN': (100, {0: '\u0b66', 10: '\u0b67\u0b66', 99: '\u0b6f\u0b6f'}),
|
85 | 88 | 'shn_MM': (100, {0: '\u1090\u1090', 10: '\u1091\u1090', 99: '\u1099\u1099'}),
|
| 89 | + 'ar_AE': (100, {0: '\u0660', 10: '\u0661\u0660', 99: '\u0669\u0669'}), |
| 90 | + 'bn_IN': (100, {0: '\u09e6', 10: '\u09e7\u09e6', 99: '\u09ef\u09ef'}), |
86 | 91 | }
|
87 | 92 |
|
88 | 93 | if sys.platform == 'win32':
|
@@ -196,22 +201,29 @@ def test_lc_numeric_basic(self):
|
196 | 201 | def test_alt_digits_nl_langinfo(self):
|
197 | 202 | # Test nl_langinfo(ALT_DIGITS)
|
198 | 203 | tested = False
|
199 |
| - for loc, (count, samples) in known_alt_digits.items(): |
| 204 | + for loc in candidate_locales: |
200 | 205 | with self.subTest(locale=loc):
|
201 | 206 | try:
|
202 | 207 | setlocale(LC_TIME, loc)
|
203 | 208 | setlocale(LC_CTYPE, loc)
|
204 | 209 | except Error:
|
205 | 210 | self.skipTest(f'no locale {loc!r}')
|
206 | 211 | continue
|
| 212 | + |
207 | 213 | with self.subTest(locale=loc):
|
208 | 214 | alt_digits = nl_langinfo(locale.ALT_DIGITS)
|
209 |
| - self.assertIsInstance(alt_digits, tuple) |
210 |
| - if count and not alt_digits and support.is_apple: |
211 |
| - self.skipTest(f'ALT_DIGITS is not set for locale {loc!r} on Apple platforms') |
212 |
| - self.assertEqual(len(alt_digits), count) |
213 |
| - for i in samples: |
214 |
| - self.assertEqual(alt_digits[i], samples[i]) |
| 215 | + self.assertIsInstance(alt_digits, str) |
| 216 | + alt_digits = alt_digits.split(';') if alt_digits else [] |
| 217 | + if alt_digits: |
| 218 | + self.assertGreaterEqual(len(alt_digits), 10, alt_digits) |
| 219 | + loc1 = loc.split('.', 1)[0] |
| 220 | + if loc1 in known_alt_digits: |
| 221 | + count, samples = known_alt_digits[loc1] |
| 222 | + if count and not alt_digits: |
| 223 | + self.skipTest(f'ALT_DIGITS is not set for locale {loc!r} on this platform') |
| 224 | + self.assertEqual(len(alt_digits), count, alt_digits) |
| 225 | + for i in samples: |
| 226 | + self.assertEqual(alt_digits[i], samples[i]) |
215 | 227 | tested = True
|
216 | 228 | if not tested:
|
217 | 229 | self.skipTest('no suitable locales')
|
|
0 commit comments