(self)
| 358 | self.assertEqual(bm[n:], b'x' * (len(bm[n:]))) |
| 359 | |
| 360 | def test_readinto1_array(self): |
| 361 | buffer_size = 60 |
| 362 | data = b"a" * 26 |
| 363 | rawio = self.MockRawIO((data,)) |
| 364 | bufio = self.tp(rawio, buffer_size=buffer_size) |
| 365 | |
| 366 | # Create an array with element size > 1 byte |
| 367 | b = array.array('i', b'x' * 32) |
| 368 | assert len(b) != 16 |
| 369 | |
| 370 | # Read into it. We should get as many *bytes* as we can fit into b |
| 371 | # (which is more than the number of elements) |
| 372 | n = bufio.readinto1(b) |
| 373 | self.assertGreater(n, len(b)) |
| 374 | |
| 375 | # Check that old contents of b are preserved |
| 376 | bm = memoryview(b).cast('B') |
| 377 | self.assertLess(n, len(bm)) |
| 378 | self.assertEqual(bm[:n], data[:n]) |
| 379 | self.assertEqual(bm[n:], b'x' * (len(bm[n:]))) |
| 380 | |
| 381 | def test_readlines(self): |
| 382 | def bufio(): |
nothing calls this directly
no test coverage detected