(self)
| 904 | b"abc\xed\xa0z".decode(self.encoding, "surrogatepass") |
| 905 | |
| 906 | def test_incremental_errors(self): |
| 907 | # Test that the incremental decoder can fail with final=False. |
| 908 | # See issue #24214 |
| 909 | cases = [b'\x80', b'\xBF', b'\xC0', b'\xC1', b'\xF5', b'\xF6', b'\xFF'] |
| 910 | for prefix in (b'\xC2', b'\xDF', b'\xE0', b'\xE0\xA0', b'\xEF', |
| 911 | b'\xEF\xBF', b'\xF0', b'\xF0\x90', b'\xF0\x90\x80', |
| 912 | b'\xF4', b'\xF4\x8F', b'\xF4\x8F\xBF'): |
| 913 | for suffix in b'\x7F', b'\xC0': |
| 914 | cases.append(prefix + suffix) |
| 915 | cases.extend((b'\xE0\x80', b'\xE0\x9F', b'\xED\xA0\x80', |
| 916 | b'\xED\xBF\xBF', b'\xF0\x80', b'\xF0\x8F', b'\xF4\x90')) |
| 917 | |
| 918 | for data in cases: |
| 919 | with self.subTest(data=data): |
| 920 | dec = codecs.getincrementaldecoder(self.encoding)() |
| 921 | self.assertRaises(UnicodeDecodeError, dec.decode, data) |
| 922 | |
| 923 | |
| 924 | class UTF7Test(ReadTest, unittest.TestCase): |
nothing calls this directly
no test coverage detected