summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index e5cb08c..1ca3eda 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -4016,6 +4016,28 @@ class CTextIOWrapperTest(TextIOWrapperTest):
t.write("x"*chunk_size)
self.assertEqual([b"abcdef", b"ghi", b"x"*chunk_size], buf._write_stack)
+ def test_issue119506(self):
+ chunk_size = 8192
+
+ class MockIO(self.MockRawIO):
+ written = False
+ def write(self, data):
+ if not self.written:
+ self.written = True
+ t.write("middle")
+ return super().write(data)
+
+ buf = MockIO()
+ t = self.TextIOWrapper(buf)
+ t.write("abc")
+ t.write("def")
+ # writing data which size >= chunk_size cause flushing buffer before write.
+ t.write("g" * chunk_size)
+ t.flush()
+
+ self.assertEqual([b"abcdef", b"middle", b"g"*chunk_size],
+ buf._write_stack)
+
class PyTextIOWrapperTest(TextIOWrapperTest):
io = pyio