(self)
| 3356 | text.encode, f'cp{cp}', errors) |
| 3357 | |
| 3358 | def test_cp932(self): |
| 3359 | self.check_encode(932, ( |
| 3360 | ('abc', 'strict', b'abc'), |
| 3361 | ('\uff44\u9a3e', 'strict', b'\x82\x84\xe9\x80'), |
| 3362 | ('\uf8f3', 'strict', b'\xff'), |
| 3363 | # test error handlers |
| 3364 | ('\xff', 'strict', None), |
| 3365 | ('[\xff]', 'ignore', b'[]'), |
| 3366 | ('[\xff]', 'replace', b'[y]', b'[?]'), |
| 3367 | ('[\u20ac]', 'replace', b'[?]'), |
| 3368 | ('[\xff]', 'backslashreplace', b'[\\xff]'), |
| 3369 | ('[\xff]', 'namereplace', |
| 3370 | b'[\\N{LATIN SMALL LETTER Y WITH DIAERESIS}]'), |
| 3371 | ('[\xff]', 'xmlcharrefreplace', b'[ÿ]'), |
| 3372 | ('\udcff', 'strict', None), |
| 3373 | ('[\udcff]', 'surrogateescape', b'[\xff]'), |
| 3374 | ('[\udcff]', 'surrogatepass', None), |
| 3375 | )) |
| 3376 | self.check_decode(932, ( |
| 3377 | (b'abc', 'strict', 'abc'), |
| 3378 | (b'\x82\x84\xe9\x80', 'strict', '\uff44\u9a3e'), |
| 3379 | # invalid bytes |
| 3380 | (b'[\xff]', 'strict', None, '[\uf8f3]'), |
| 3381 | (b'[\xff]', 'ignore', '[]', '[\uf8f3]'), |
| 3382 | (b'[\xff]', 'replace', '[\ufffd]', '[\uf8f3]'), |
| 3383 | (b'[\xff]', 'backslashreplace', '[\\xff]', '[\uf8f3]'), |
| 3384 | (b'[\xff]', 'surrogateescape', '[\udcff]', '[\uf8f3]'), |
| 3385 | (b'[\xff]', 'surrogatepass', None, '[\uf8f3]'), |
| 3386 | (b'\x81\x00abc', 'strict', None), |
| 3387 | (b'\x81\x00abc', 'ignore', '\x00abc'), |
| 3388 | (b'\x81\x00abc', 'replace', '\ufffd\x00abc'), |
| 3389 | (b'\x81\x00abc', 'backslashreplace', '\\x81\x00abc'), |
| 3390 | )) |
| 3391 | |
| 3392 | def test_cp1252(self): |
| 3393 | self.check_encode(1252, ( |
nothing calls this directly
no test coverage detected