(self)
| 206 | @unittest.skipUnless(hasattr(locale, 'ALT_DIGITS'), "requires locale.ALT_DIGITS") |
| 207 | @unittest.skipIf(support.linked_to_musl(), "musl libc issue, bpo-46390") |
| 208 | def test_alt_digits_nl_langinfo(self): |
| 209 | # Test nl_langinfo(ALT_DIGITS) |
| 210 | tested = False |
| 211 | for loc in candidate_locales: |
| 212 | with self.subTest(locale=loc): |
| 213 | try: |
| 214 | setlocale(LC_TIME, loc) |
| 215 | except Error: |
| 216 | self.skipTest(f'no locale {loc!r}') |
| 217 | continue |
| 218 | |
| 219 | with self.subTest(locale=loc): |
| 220 | alt_digits = nl_langinfo(locale.ALT_DIGITS) |
| 221 | self.assertIsInstance(alt_digits, str) |
| 222 | alt_digits = alt_digits.split(';') if alt_digits else [] |
| 223 | if alt_digits: |
| 224 | self.assertGreaterEqual(len(alt_digits), 10, alt_digits) |
| 225 | loc1 = loc.split('.', 1)[0] |
| 226 | if loc1 in known_alt_digits: |
| 227 | count, samples = known_alt_digits[loc1] |
| 228 | if count and not alt_digits: |
| 229 | self.skipTest(f'ALT_DIGITS is not set for locale {loc!r} on this platform') |
| 230 | self.assertEqual(len(alt_digits), count, alt_digits) |
| 231 | for i in samples: |
| 232 | self.assertEqual(alt_digits[i], samples[i]) |
| 233 | tested = True |
| 234 | if not tested: |
| 235 | self.skipTest('no suitable locales') |
| 236 | |
| 237 | @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available") |
| 238 | @unittest.skipUnless(hasattr(locale, 'ERA'), "requires locale.ERA") |
nothing calls this directly
no test coverage detected