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

Method test_issue119506

Lib/test/test_io/test_textio.py:1525–1545  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1523 self.assertEqual([b"abcdef", b"ghi", b"x"*chunk_size], buf._write_stack)
1524
1525 def test_issue119506(self):
1526 chunk_size = 8192
1527
1528 class MockIO(self.MockRawIO):
1529 written = False
1530 def write(self, data):
1531 if not self.written:
1532 self.written = True
1533 t.write("middle")
1534 return super().write(data)
1535
1536 buf = MockIO()
1537 t = self.TextIOWrapper(buf)
1538 t.write("abc")
1539 t.write("def")
1540 # writing data which size >= chunk_size cause flushing buffer before write.
1541 t.write("g" * chunk_size)
1542 t.flush()
1543
1544 self.assertEqual([b"abcdef", b"middle", b"g"*chunk_size],
1545 buf._write_stack)
1546
1547 def test_issue142594(self):
1548 wrapper = None

Callers

nothing calls this directly

Calls 4

writeMethod · 0.95
flushMethod · 0.95
MockIOClass · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected