MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_reconfigure_encoding_read

Method test_reconfigure_encoding_read

Lib/test/test_io.py:3861–3871  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3859 wrapper.reconfigure(encoding="locale")
3860
3861 def test_reconfigure_encoding_read(self):
3862 # latin1 -> utf8
3863 # (latin1 can decode utf-8 encoded string)
3864 data = 'abc\xe9\n'.encode('latin1') + 'd\xe9f\n'.encode('utf8')
3865 raw = self.BytesIO(data)
3866 txt = self.TextIOWrapper(raw, encoding='latin1', newline='\n')
3867 self.assertEqual(txt.readline(), 'abc\xe9\n')
3868 with self.assertRaises(self.UnsupportedOperation):
3869 txt.reconfigure(encoding='utf-8')
3870 with self.assertRaises(self.UnsupportedOperation):
3871 txt.reconfigure(newline=None)
3872
3873 def test_reconfigure_write_fromascii(self):
3874 # ascii has a specific encodefunc in the C implementation,

Callers

nothing calls this directly

Calls 5

readlineMethod · 0.95
reconfigureMethod · 0.95
encodeMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected