(self)
| 1596 | self.assertEqual(bm[n:], b'x' * (len(bm[n:]))) |
| 1597 | |
| 1598 | def test_readinto1_array(self): |
| 1599 | buffer_size = 60 |
| 1600 | data = b"a" * 26 |
| 1601 | rawio = self.MockRawIO((data,)) |
| 1602 | bufio = self.tp(rawio, buffer_size=buffer_size) |
| 1603 | |
| 1604 | # Create an array with element size > 1 byte |
| 1605 | b = array.array('i', b'x' * 32) |
| 1606 | assert len(b) != 16 |
| 1607 | |
| 1608 | # Read into it. We should get as many *bytes* as we can fit into b |
| 1609 | # (which is more than the number of elements) |
| 1610 | n = bufio.readinto1(b) |
| 1611 | self.assertGreater(n, len(b)) |
| 1612 | |
| 1613 | # Check that old contents of b are preserved |
| 1614 | bm = memoryview(b).cast('B') |
| 1615 | self.assertLess(n, len(bm)) |
| 1616 | self.assertEqual(bm[:n], data[:n]) |
| 1617 | self.assertEqual(bm[n:], b'x' * (len(bm[n:]))) |
| 1618 | |
| 1619 | def test_readlines(self): |
| 1620 | def bufio(): |
nothing calls this directly
no test coverage detected