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

Method test_errors

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

Source from the content-addressed store, hash-verified

763 )
764
765 def test_errors(self):
766 tests = [
767 (b'\xff', '\ufffd'),
768 (b'A\x00Z', 'A\ufffd'),
769 (b'A\x00B\x00C\x00D\x00Z', 'ABCD\ufffd'),
770 (b'\x00\xd8', '\ufffd'),
771 (b'\x00\xd8A', '\ufffd'),
772 (b'\x00\xd8A\x00', '\ufffdA'),
773 (b'\x00\xdcA\x00', '\ufffdA'),
774 ]
775 for raw, expected in tests:
776 self.assertRaises(UnicodeDecodeError, codecs.utf_16_le_decode,
777 raw, 'strict', True)
778 self.assertEqual(raw.decode('utf-16le', 'replace'), expected)
779
780 def test_nonbmp(self):
781 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