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

Method test_reconfigure_defaults

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

Source from the content-addressed store, hash-verified

3917 self.assertEqual(raw.getvalue(), b'abc\n\xef\xbb\xbfd\xc3\xa9f\n')
3918
3919 def test_reconfigure_defaults(self):
3920 txt = self.TextIOWrapper(self.BytesIO(), 'ascii', 'replace', '\n')
3921 txt.reconfigure(encoding=None)
3922 self.assertEqual(txt.encoding, 'ascii')
3923 self.assertEqual(txt.errors, 'replace')
3924 txt.write('LF\n')
3925
3926 txt.reconfigure(newline='\r\n')
3927 self.assertEqual(txt.encoding, 'ascii')
3928 self.assertEqual(txt.errors, 'replace')
3929
3930 txt.reconfigure(errors='ignore')
3931 self.assertEqual(txt.encoding, 'ascii')
3932 self.assertEqual(txt.errors, 'ignore')
3933 txt.write('CRLF\n')
3934
3935 txt.reconfigure(encoding='utf-8', newline=None)
3936 self.assertEqual(txt.errors, 'strict')
3937 txt.seek(0)
3938 self.assertEqual(txt.read(), 'LF\nCRLF\n')
3939
3940 self.assertEqual(txt.detach().getvalue(), b'LF\nCRLF\r\n')
3941
3942 def test_reconfigure_errors(self):
3943 txt = self.TextIOWrapper(self.BytesIO(), 'ascii', 'replace', '\r')

Callers

nothing calls this directly

Calls 7

reconfigureMethod · 0.95
writeMethod · 0.95
seekMethod · 0.95
readMethod · 0.95
detachMethod · 0.95
assertEqualMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected