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

Method test_line_buffering

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

Source from the content-addressed store, hash-verified

295 self.assertIn(TestSubclass.__name__, repr(f))
296
297 def test_line_buffering(self):
298 r = self.BytesIO()
299 b = self.BufferedWriter(r, 1000)
300 t = self.TextIOWrapper(b, encoding="utf-8", newline="\n", line_buffering=True)
301 t.write("X")
302 self.assertEqual(r.getvalue(), b"") # No flush happened
303 t.write("Y\nZ")
304 self.assertEqual(r.getvalue(), b"XY\nZ") # All got flushed
305 t.write("A\rB")
306 self.assertEqual(r.getvalue(), b"XY\nZA\rB")
307
308 def test_reconfigure_line_buffering(self):
309 r = self.BytesIO()

Callers

nothing calls this directly

Calls 3

writeMethod · 0.95
getvalueMethod · 0.95
assertEqualMethod · 0.45

Tested by

no test coverage detected