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

Method test_locale

Lib/test/test_format.py:427–450  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

425
426 @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AssertionError: ',' not found in '123456789'")
427 def test_locale(self):
428 try:
429 oldloc = locale.setlocale(locale.LC_ALL)
430 locale.setlocale(locale.LC_ALL, '')
431 except locale.Error as err:
432 self.skipTest("Cannot set locale: {}".format(err))
433 try:
434 localeconv = locale.localeconv()
435 sep = localeconv['thousands_sep']
436 point = localeconv['decimal_point']
437 grouping = localeconv['grouping']
438
439 text = format(123456789, "n")
440 if grouping:
441 self.assertIn(sep, text)
442 self.assertEqual(text.replace(sep, ''), '123456789')
443
444 text = format(1234.5, "n")
445 if grouping:
446 self.assertIn(sep, text)
447 self.assertIn(point, text)
448 self.assertEqual(text.replace(sep, ''), '1234' + point + '5')
449 finally:
450 locale.setlocale(locale.LC_ALL, oldloc)
451
452 @support.cpython_only
453 def test_optimisations(self):

Callers

nothing calls this directly

Calls 6

skipTestMethod · 0.80
assertInMethod · 0.80
formatFunction · 0.50
formatMethod · 0.45
assertEqualMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected