(self)
| 1646 | 'b': [b'ij']}]) |
| 1647 | |
| 1648 | def test_inference_failure(self): |
| 1649 | # Inference on first block, then conversion failure on second block |
| 1650 | rows = b"a,b\n123,456\nabc,de\xff\ngh,ij\n" |
| 1651 | read_options = ReadOptions() |
| 1652 | read_options.block_size = len(rows) - 7 |
| 1653 | reader = self.open_bytes(rows, read_options=read_options) |
| 1654 | expected_schema = pa.schema([('a', pa.int64()), |
| 1655 | ('b', pa.int64())]) |
| 1656 | assert reader.schema == expected_schema |
| 1657 | assert reader.read_next_batch().to_pydict() == { |
| 1658 | 'a': [123], 'b': [456] |
| 1659 | } |
| 1660 | # Second block |
| 1661 | with pytest.raises(ValueError, |
| 1662 | match="CSV conversion error to int64"): |
| 1663 | reader.read_next_batch() |
| 1664 | # EOF |
| 1665 | with pytest.raises(StopIteration): |
| 1666 | reader.read_next_batch() |
| 1667 | |
| 1668 | def test_invalid_csv(self): |
| 1669 | # CSV errors on first block |
nothing calls this directly
no test coverage detected