MCPcopy Index your code
hub / github.com/python/cpython / test_write

Method test_write

Lib/test/test_io/test_bufferedio.py:1087–1097  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1085 support.gc_collect()
1086
1087 def test_write(self):
1088 w = self.MockRawIO()
1089 pair = self.tp(self.MockRawIO(), w)
1090
1091 pair.write(b"abc")
1092 pair.flush()
1093 buffer = bytearray(b"def")
1094 pair.write(buffer)
1095 buffer[:] = b"***" # Overwrite our copy of the data
1096 pair.flush()
1097 self.assertEqual(w._write_stack, [b"abc", b"def"])
1098
1099 def test_peek(self):
1100 pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO())

Callers

nothing calls this directly

Calls 3

writeMethod · 0.45
flushMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected