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

Method test_errors

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

Source from the content-addressed store, hash-verified

807 )
808
809 def test_errors(self):
810 tests = [
811 (b'\xff', '\ufffd'),
812 (b'\x00A\xff', 'A\ufffd'),
813 (b'\x00A\x00B\x00C\x00DZ', 'ABCD\ufffd'),
814 (b'\xd8\x00', '\ufffd'),
815 (b'\xd8\x00\xdc', '\ufffd'),
816 (b'\xd8\x00\x00A', '\ufffdA'),
817 (b'\xdc\x00\x00A', '\ufffdA'),
818 ]
819 for raw, expected in tests:
820 self.assertRaises(UnicodeDecodeError, codecs.utf_16_be_decode,
821 raw, 'strict', True)
822 self.assertEqual(raw.decode('utf-16be', 'replace'), expected)
823
824 def test_nonbmp(self):
825 self.assertEqual("\U00010203".encode(self.encoding),

Callers

nothing calls this directly

Calls 3

assertRaisesMethod · 0.45
assertEqualMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected