MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_era_nl_langinfo

Method test_era_nl_langinfo

Lib/test/test__locale.py:240–269  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

238 @unittest.skipUnless(hasattr(locale, 'ERA'), "requires locale.ERA")
239 @unittest.skipIf(support.linked_to_musl(), "musl libc issue, bpo-46390")
240 def test_era_nl_langinfo(self):
241 # Test nl_langinfo(ERA)
242 tested = False
243 for loc in candidate_locales:
244 with self.subTest(locale=loc):
245 try:
246 setlocale(LC_TIME, loc)
247 except Error:
248 self.skipTest(f'no locale {loc!r}')
249 continue
250
251 with self.subTest(locale=loc):
252 era = nl_langinfo(locale.ERA)
253 self.assertIsInstance(era, str)
254 if era:
255 self.assertEqual(era.count(':'), (era.count(';') + 1) * 5, era)
256
257 loc1 = loc.split('.', 1)[0]
258 if loc1 in known_era:
259 count, sample = known_era[loc1]
260 if count:
261 if not era:
262 self.skipTest(f'ERA is not set for locale {loc!r} on this platform')
263 self.assertGreaterEqual(era.count(';') + 1, count)
264 self.assertIn(sample, era)
265 else:
266 self.assertEqual(era, '')
267 tested = True
268 if not tested:
269 self.skipTest('no suitable locales')
270
271 def test_float_parsing(self):
272 # Bug #1391872: Test whether float parsing is okay on European

Callers

nothing calls this directly

Calls 9

subTestMethod · 0.80
skipTestMethod · 0.80
assertIsInstanceMethod · 0.80
assertGreaterEqualMethod · 0.80
assertInMethod · 0.80
setlocaleFunction · 0.50
assertEqualMethod · 0.45
countMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected