Test that an 'invalid start byte' error is raised when the first byte is not in the ASCII range or is not a valid start byte of a 2-, 3-, or 4-bytes sequence. The invalid start byte is replaced with a single U+FFFD when errors='replace'. E.g. <80> is a contin
(self)
| 2043 | 'aaaa' + res + 'bbbb') |
| 2044 | |
| 2045 | def test_invalid_start_byte(self): |
| 2046 | """ |
| 2047 | Test that an 'invalid start byte' error is raised when the first byte |
| 2048 | is not in the ASCII range or is not a valid start byte of a 2-, 3-, or |
| 2049 | 4-bytes sequence. The invalid start byte is replaced with a single |
| 2050 | U+FFFD when errors='replace'. |
| 2051 | E.g. <80> is a continuation byte and can appear only after a start byte. |
| 2052 | """ |
| 2053 | FFFD = '\ufffd' |
| 2054 | for byte in b'\x80\xA0\x9F\xBF\xC0\xC1\xF5\xFF': |
| 2055 | self.assertCorrectUTF8Decoding(bytes([byte]), '\ufffd', |
| 2056 | 'invalid start byte') |
| 2057 | |
| 2058 | def test_unexpected_end_of_data(self): |
| 2059 | """ |
nothing calls this directly
no test coverage detected