Lines Matching +full:formatting +full:- +full:check
19 tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US")
28 tlocs = ("en_US.UTF-8", "en_US.ISO8859-1",
29 "en_US.US-ASCII", "en_US")
104 'negative_sign': '-',
115 # and a non-ASCII currency symbol.
130 'negative_sign': '-',
141 # Utility functions for formatting tests
171 self._test_format("%f", -42, grouping=1, out='-42.000000')
172 self._test_format("%+f", -42, grouping=1, out='-42.000000')
175 self._test_format("%20.f", -42, grouping=1, out='-42'.rjust(20))
177 self._test_format("%+10.f", -4200, grouping=1,
178 out=('-4%s200' % self.sep).rjust(10))
179 self._test_format("%-10.f", -4200, grouping=1,
180 out=('-4%s200' % self.sep).ljust(10))
185 self._test_format("%+d", -4200, grouping=True, out='-4%s200' % self.sep)
190 self._test_format("%-10d", -4200, grouping=True,
191 out=('-4%s200' % self.sep).ljust(10))
196 self._test_format("%f", -42, grouping=0, out='-42.000000')
197 self._test_format("%+f", -42, grouping=0, out='-42.000000')
200 self._test_format("%20.f", -42, grouping=0, out='-42'.rjust(20))
201 self._test_format("%+10.f", -4200, grouping=0, out='-4200'.rjust(10))
202 self._test_format("%-10.f", 4200, grouping=0, out='4200'.ljust(10))
206 locale.format("%-10.f", 4200, grouping=True)
209 # Spaces in formatting string
214 # Dots in formatting string
218 self._test_format_string("--> %10.2f", 4200, grouping=1,
219 out='--> ' + ('4%s200.00' % self.sep).rjust(10))
226 # Test more-in-one
268 # Test number formatting with a real English locale.
278 # Test number formatting with a cooked "en_US" locale.
292 # Test number formatting with a cooked "C" locale.
302 # Test number formatting with a cooked "fr_FR" locale.
317 self._test_format("%-6.2f", 345.67, grouping=True, out='345,67')
318 self._test_format("%-7.2f", 345.67, grouping=True, out='345,67 ')
319 self._test_format("%-8.2f", 12345.67, grouping=True, out='12 345,67')
320 self._test_format("%-9.2f", 12345.67, grouping=True, out='12 345,67')
321 self._test_format("%-10.2f", 12345.67, grouping=True, out='12 345,67 ')
331 self._test_format("%-4d", 4200, grouping=True, out='4 200')
332 self._test_format("%-5d", 4200, grouping=True, out='4 200')
333 self._test_format("%-10d", 4200, grouping=True, out='4 200'.ljust(10))
367 if enc not in ('utf-8', 'iso8859-1', 'cp1252'):
369 if enc != 'iso8859-1' and (sys.platform == 'darwin' or is_android or
375 'bpo-29972: broken test on AIX')
378 "musl libc issue on Emscripten/WASI, bpo-46390"
384 'bpo-29972: broken test on AIX')
387 "musl libc issue on Emscripten/WASI, bpo-46390"
394 def check(self, localename, expected): member in NormalizeTest
400 self.check(localename, alias)
403 self.check('', '')
406 self.check('c', 'C')
407 self.check('posix', 'C')
410 self.check('en', 'en_US.ISO8859-1')
411 self.check('EN', 'en_US.ISO8859-1')
412 self.check('en.iso88591', 'en_US.ISO8859-1')
413 self.check('en_US', 'en_US.ISO8859-1')
414 self.check('en_us', 'en_US.ISO8859-1')
415 self.check('en_GB', 'en_GB.ISO8859-1')
416 self.check('en_US.UTF-8', 'en_US.UTF-8')
417 self.check('en_US.utf8', 'en_US.UTF-8')
418 self.check('en_US:UTF-8', 'en_US.UTF-8')
419 self.check('en_US.ISO8859-1', 'en_US.ISO8859-1')
420 self.check('en_US.US-ASCII', 'en_US.ISO8859-1')
421 self.check('en_US.88591', 'en_US.ISO8859-1')
422 self.check('en_US.885915', 'en_US.ISO8859-15')
423 self.check('english', 'en_EN.ISO8859-1')
424 self.check('english_uk.ascii', 'en_GB.ISO8859-1')
427 self.check('az_AZ.iso88599e', 'az_AZ.ISO8859-9E')
428 self.check('az_AZ.ISO8859-9E', 'az_AZ.ISO8859-9E')
429 self.check('tt_RU.koi8c', 'tt_RU.KOI8-C')
430 self.check('tt_RU.KOI8-C', 'tt_RU.KOI8-C')
431 self.check('lo_LA.cp1133', 'lo_LA.IBM-CP1133')
432 self.check('lo_LA.ibmcp1133', 'lo_LA.IBM-CP1133')
433 self.check('lo_LA.IBM-CP1133', 'lo_LA.IBM-CP1133')
434 self.check('uk_ua.microsoftcp1251', 'uk_UA.CP1251')
435 self.check('uk_ua.microsoft-cp1251', 'uk_UA.CP1251')
436 self.check('ka_ge.georgianacademy', 'ka_GE.GEORGIAN-ACADEMY')
437 self.check('ka_GE.GEORGIAN-ACADEMY', 'ka_GE.GEORGIAN-ACADEMY')
438 self.check('cs_CZ.iso88592', 'cs_CZ.ISO8859-2')
439 self.check('cs_CZ.ISO8859-2', 'cs_CZ.ISO8859-2')
442 self.check('de_DE@euro', 'de_DE.ISO8859-15')
443 self.check('en_US.ISO8859-15@euro', 'en_US.ISO8859-15')
444 self.check('de_DE.utf8@euro', 'de_DE.UTF-8')
447 self.check('be_BY.UTF-8@latin', 'be_BY.UTF-8@latin')
448 self.check('sr_RS.UTF-8@latin', 'sr_RS.UTF-8@latin')
449 self.check('sr_RS.UTF-8@latn', 'sr_RS.UTF-8@latin')
452 self.check('ca_ES.UTF-8@valencia', 'ca_ES.UTF-8@valencia')
453 self.check('ca_ES@valencia', 'ca_ES.UTF-8@valencia')
454 self.check('ca@valencia', 'ca_ES.ISO8859-1@valencia')
457 self.check('ks_IN.UTF-8@devanagari', 'ks_IN.UTF-8@devanagari')
458 self.check('ks_IN@devanagari', 'ks_IN.UTF-8@devanagari')
459 self.check('ks@devanagari', 'ks_IN.UTF-8@devanagari')
460 self.check('ks_IN.UTF-8', 'ks_IN.UTF-8')
461 self.check('ks_IN', 'ks_IN.UTF-8')
462 self.check('ks', 'ks_IN.UTF-8')
463 self.check('sd_IN.UTF-8@devanagari', 'sd_IN.UTF-8@devanagari')
464 self.check('sd_IN@devanagari', 'sd_IN.UTF-8@devanagari')
465 self.check('sd@devanagari', 'sd_IN.UTF-8@devanagari')
466 self.check('sd_IN.UTF-8', 'sd_IN.UTF-8')
467 self.check('sd_IN', 'sd_IN.UTF-8')
468 self.check('sd', 'sd_IN.UTF-8')
471 self.check('ja_jp.euc', 'ja_JP.eucJP')
472 self.check('ja_jp.eucjp', 'ja_JP.eucJP')
473 self.check('ko_kr.euc', 'ko_KR.eucKR')
474 self.check('ko_kr.euckr', 'ko_KR.eucKR')
475 self.check('zh_cn.euc', 'zh_CN.eucCN')
476 self.check('zh_tw.euc', 'zh_TW.eucTW')
477 self.check('zh_tw.euctw', 'zh_TW.eucTW')
480 self.check('ja', 'ja_JP.eucJP')
481 self.check('ja.jis', 'ja_JP.JIS7')
482 self.check('ja.sjis', 'ja_JP.SJIS')
483 self.check('ja_jp', 'ja_JP.eucJP')
484 self.check('ja_jp.ajec', 'ja_JP.eucJP')
485 self.check('ja_jp.euc', 'ja_JP.eucJP')
486 self.check('ja_jp.eucjp', 'ja_JP.eucJP')
487 self.check('ja_jp.iso-2022-jp', 'ja_JP.JIS7')
488 self.check('ja_jp.iso2022jp', 'ja_JP.JIS7')
489 self.check('ja_jp.jis', 'ja_JP.JIS7')
490 self.check('ja_jp.jis7', 'ja_JP.JIS7')
491 self.check('ja_jp.mscode', 'ja_JP.SJIS')
492 self.check('ja_jp.pck', 'ja_JP.SJIS')
493 self.check('ja_jp.sjis', 'ja_JP.SJIS')
494 self.check('ja_jp.ujis', 'ja_JP.eucJP')
495 self.check('ja_jp.utf8', 'ja_JP.UTF-8')
496 self.check('japan', 'ja_JP.eucJP')
497 self.check('japanese', 'ja_JP.eucJP')
498 self.check('japanese-euc', 'ja_JP.eucJP')
499 self.check('japanese.euc', 'ja_JP.eucJP')
500 self.check('japanese.sjis', 'ja_JP.SJIS')
501 self.check('jp_jp', 'ja_JP.eucJP')
506 # Issue #18378: on (at least) macOS setting LC_CTYPE to "UTF-8" is
507 # valid. Furthermore LC_CTYPE=UTF is used by the UTF-8 locale coercing
512 self.assertEqual(locale._parse_localename('UTF-8'), (None, 'UTF-8'))
527 os.environ['LC_CTYPE'] = 'UTF-8'
530 self.assertEqual(locale.getdefaultlocale(), (None, 'UTF-8'))
554 # If encoding non-empty, make sure it is valid
588 # bpo-37945: setlocale(LC_CTYPE) fails with getlocale(LC_CTYPE)