(self)
| 1223 | self.assertEqual(raw.getvalue(), b'foo\n\xc3\xa9\n') |
| 1224 | |
| 1225 | def test_reconfigure_write(self): |
| 1226 | # latin -> utf8 |
| 1227 | raw = self.BytesIO() |
| 1228 | txt = self.TextIOWrapper(raw, encoding='latin1', newline='\n') |
| 1229 | txt.write('abc\xe9\n') |
| 1230 | txt.reconfigure(encoding='utf-8') |
| 1231 | self.assertEqual(raw.getvalue(), b'abc\xe9\n') |
| 1232 | txt.write('d\xe9f\n') |
| 1233 | txt.flush() |
| 1234 | self.assertEqual(raw.getvalue(), b'abc\xe9\nd\xc3\xa9f\n') |
| 1235 | |
| 1236 | # ascii -> utf-8-sig: ensure that no BOM is written in the middle of |
| 1237 | # the file |
| 1238 | raw = self.BytesIO() |
| 1239 | txt = self.TextIOWrapper(raw, encoding='ascii', newline='\n') |
| 1240 | txt.write('abc\n') |
| 1241 | txt.reconfigure(encoding='utf-8-sig') |
| 1242 | txt.write('d\xe9f\n') |
| 1243 | txt.flush() |
| 1244 | self.assertEqual(raw.getvalue(), b'abc\nd\xc3\xa9f\n') |
| 1245 | |
| 1246 | def test_reconfigure_write_non_seekable(self): |
| 1247 | raw = self.BytesIO() |
nothing calls this directly
no test coverage detected