MCPcopy Index your code
hub / github.com/python/cpython / test_code_page_decode_flags

Method test_code_page_decode_flags

Lib/test/test_codecs.py:3497–3514  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3495 ))
3496
3497 def test_code_page_decode_flags(self):
3498 # Issue #36312: For some code pages (e.g. UTF-7) flags for
3499 # MultiByteToWideChar() must be set to 0.
3500 if support.verbose:
3501 sys.stdout.write('\n')
3502 for cp in (50220, 50221, 50222, 50225, 50227, 50229,
3503 *range(57002, 57011+1), 65000):
3504 # On small versions of Windows like Windows IoT
3505 # not all codepages are present.
3506 # A missing codepage causes an OSError exception
3507 # so check for the codepage before decoding
3508 if is_code_page_present(cp):
3509 self.assertEqual(codecs.code_page_decode(cp, b'abc'), ('abc', 3), f'cp{cp}')
3510 else:
3511 if support.verbose:
3512 print(f" skipping cp={cp}")
3513 self.assertEqual(codecs.code_page_decode(42, b'abc'),
3514 ('\uf061\uf062\uf063', 3))
3515
3516 def test_incremental(self):
3517 decoded = codecs.code_page_decode(932, b'\x82', 'strict', False)

Callers

nothing calls this directly

Calls 3

is_code_page_presentFunction · 0.85
writeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected