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

Method test_write

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

Source from the content-addressed store, hash-verified

685 self.assertEqual(raw._write_stack, [b"howdy!"])
686
687 def test_write(self):
688 # Write to the buffered IO but don't overflow the buffer.
689 writer = self.MockRawIO()
690 bufio = self.tp(writer, 8)
691 bufio.write(b"abc")
692 self.assertFalse(writer._write_stack)
693 buffer = bytearray(b"def")
694 bufio.write(buffer)
695 buffer[:] = b"***" # Overwrite our copy of the data
696 bufio.flush()
697 self.assertEqual(b"".join(writer._write_stack), b"abcdef")
698
699 def test_write_overflow(self):
700 writer = self.MockRawIO()

Callers

nothing calls this directly

Calls 5

assertFalseMethod · 0.80
writeMethod · 0.45
flushMethod · 0.45
assertEqualMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected