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

Method check_flush_and_read

Lib/test/test_io/test_bufferedio.py:1274–1290  ·  view source on GitHub ↗
(self, read_func)

Source from the content-addressed store, hash-verified

1272 self.assertRaises(TypeError, rw.seek, 0.0)
1273
1274 def check_flush_and_read(self, read_func):
1275 raw = self.BytesIO(b"abcdefghi")
1276 bufio = self.tp(raw)
1277
1278 self.assertEqual(b"ab", read_func(bufio, 2))
1279 bufio.write(b"12")
1280 self.assertEqual(b"ef", read_func(bufio, 2))
1281 self.assertEqual(6, bufio.tell())
1282 bufio.flush()
1283 self.assertEqual(6, bufio.tell())
1284 self.assertEqual(b"ghi", read_func(bufio))
1285 raw.seek(0, 0)
1286 raw.write(b"XYZ")
1287 # flush() resets the read buffer
1288 bufio.flush()
1289 bufio.seek(0, 0)
1290 self.assertEqual(b"XYZ", read_func(bufio, 3))
1291
1292 def test_flush_and_read(self):
1293 self.check_flush_and_read(lambda bufio, *args: bufio.read(*args))

Callers 3

test_flush_and_readMethod · 0.95
test_flush_and_peekMethod · 0.95

Calls 7

seekMethod · 0.95
writeMethod · 0.95
assertEqualMethod · 0.45
writeMethod · 0.45
tellMethod · 0.45
flushMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected