(self)
| 964 | self.assertFalse(kwargs) |
| 965 | |
| 966 | def test_errors(self): |
| 967 | with open(TESTFN, 'wb') as f: |
| 968 | f.write(b'\x80abc') |
| 969 | self.addCleanup(safe_unlink, TESTFN) |
| 970 | |
| 971 | def check(errors, expected_lines): |
| 972 | with FileInput(files=TESTFN, mode='r', |
| 973 | openhook=hook_encoded('utf-8', errors=errors)) as fi: |
| 974 | lines = list(fi) |
| 975 | self.assertEqual(lines, expected_lines) |
| 976 | |
| 977 | check('ignore', ['abc']) |
| 978 | with self.assertRaises(UnicodeDecodeError): |
| 979 | check('strict', ['abc']) |
| 980 | check('replace', ['\ufffdabc']) |
| 981 | check('backslashreplace', ['\\x80abc']) |
| 982 | |
| 983 | def test_modes(self): |
| 984 | with open(TESTFN, 'wb') as f: |
nothing calls this directly
no test coverage detected