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

Method test_reconfigure_write_through

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

Source from the content-addressed store, hash-verified

3714 self.assertEqual(rawio.getvalue(), data * 11) # all flushed
3715
3716 def test_reconfigure_write_through(self):
3717 raw = self.MockRawIO([])
3718 t = self.TextIOWrapper(raw, encoding='ascii', newline='\n')
3719 t.write('1')
3720 t.reconfigure(write_through=True) # implied flush
3721 self.assertEqual(t.write_through, True)
3722 self.assertEqual(b''.join(raw._write_stack), b'1')
3723 t.write('23')
3724 self.assertEqual(b''.join(raw._write_stack), b'123')
3725 t.reconfigure(write_through=False)
3726 self.assertEqual(t.write_through, False)
3727 t.write('45')
3728 t.flush()
3729 self.assertEqual(b''.join(raw._write_stack), b'12345')
3730 # Keeping default value
3731 t.reconfigure()
3732 t.reconfigure(write_through=None)
3733 self.assertEqual(t.write_through, False)
3734 t.reconfigure(write_through=True)
3735 t.reconfigure()
3736 t.reconfigure(write_through=None)
3737 self.assertEqual(t.write_through, True)
3738
3739 def test_read_nonbytes(self):
3740 # Issue #17106

Callers

nothing calls this directly

Calls 5

writeMethod · 0.95
reconfigureMethod · 0.95
flushMethod · 0.95
assertEqualMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected