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

Method test_errors

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

Source from the content-addressed store, hash-verified

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