(self, read_func)
| 2463 | self.assertRaises(TypeError, rw.seek, 0.0) |
| 2464 | |
| 2465 | def check_flush_and_read(self, read_func): |
| 2466 | raw = self.BytesIO(b"abcdefghi") |
| 2467 | bufio = self.tp(raw) |
| 2468 | |
| 2469 | self.assertEqual(b"ab", read_func(bufio, 2)) |
| 2470 | bufio.write(b"12") |
| 2471 | self.assertEqual(b"ef", read_func(bufio, 2)) |
| 2472 | self.assertEqual(6, bufio.tell()) |
| 2473 | bufio.flush() |
| 2474 | self.assertEqual(6, bufio.tell()) |
| 2475 | self.assertEqual(b"ghi", read_func(bufio)) |
| 2476 | raw.seek(0, 0) |
| 2477 | raw.write(b"XYZ") |
| 2478 | # flush() resets the read buffer |
| 2479 | bufio.flush() |
| 2480 | bufio.seek(0, 0) |
| 2481 | self.assertEqual(b"XYZ", read_func(bufio, 3)) |
| 2482 | |
| 2483 | def test_flush_and_read(self): |
| 2484 | self.check_flush_and_read(lambda bufio, *args: bufio.read(*args)) |
no test coverage detected