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

Method test_issue119506

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

Source from the content-addressed store, hash-verified

4190 self.assertEqual([b"abcdef", b"ghi", b"x"*chunk_size], buf._write_stack)
4191
4192 def test_issue119506(self):
4193 chunk_size = 8192
4194
4195 class MockIO(self.MockRawIO):
4196 written = False
4197 def write(self, data):
4198 if not self.written:
4199 self.written = True
4200 t.write("middle")
4201 return super().write(data)
4202
4203 buf = MockIO()
4204 t = self.TextIOWrapper(buf)
4205 t.write("abc")
4206 t.write("def")
4207 # writing data which size >= chunk_size cause flushing buffer before write.
4208 t.write("g" * chunk_size)
4209 t.flush()
4210
4211 self.assertEqual([b"abcdef", b"middle", b"g"*chunk_size],
4212 buf._write_stack)
4213
4214 def test_issue142594(self):
4215 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