(self)
| 1736 | reader.read_next_batch() |
| 1737 | |
| 1738 | def test_invalid_csv(self): |
| 1739 | # CSV errors on first block |
| 1740 | rows = b"a,b\n1,2,3\n4,5\n6,7\n" |
| 1741 | read_options = ReadOptions() |
| 1742 | read_options.block_size = 10 |
| 1743 | with pytest.raises(pa.ArrowInvalid, |
| 1744 | match="Expected 2 columns, got 3"): |
| 1745 | reader = self.open_bytes( |
| 1746 | rows, read_options=read_options) |
| 1747 | |
| 1748 | # CSV errors on second block |
| 1749 | rows = b"a,b\n1,2\n3,4,5\n6,7\n" |
| 1750 | read_options.block_size = 8 |
| 1751 | reader = self.open_bytes(rows, read_options=read_options) |
| 1752 | assert reader.read_next_batch().to_pydict() == {'a': [1], 'b': [2]} |
| 1753 | with pytest.raises(pa.ArrowInvalid, |
| 1754 | match="Expected 2 columns, got 3"): |
| 1755 | reader.read_next_batch() |
| 1756 | # Cannot continue after a parse error |
| 1757 | with pytest.raises(StopIteration): |
| 1758 | reader.read_next_batch() |
| 1759 | |
| 1760 | def test_options_delimiter(self): |
| 1761 | rows = b"a;b,c\nde,fg;eh\n" |
nothing calls this directly
no test coverage detected