(self)
| 1716 | 'b': [b'ij']}]) |
| 1717 | |
| 1718 | def test_inference_failure(self): |
| 1719 | # Inference on first block, then conversion failure on second block |
| 1720 | rows = b"a,b\n123,456\nabc,de\xff\ngh,ij\n" |
| 1721 | read_options = ReadOptions() |
| 1722 | read_options.block_size = len(rows) - 7 |
| 1723 | reader = self.open_bytes(rows, read_options=read_options) |
| 1724 | expected_schema = pa.schema([('a', pa.int64()), |
| 1725 | ('b', pa.int64())]) |
| 1726 | assert reader.schema == expected_schema |
| 1727 | assert reader.read_next_batch().to_pydict() == { |
| 1728 | 'a': [123], 'b': [456] |
| 1729 | } |
| 1730 | # Second block |
| 1731 | with pytest.raises(ValueError, |
| 1732 | match="CSV conversion error to int64"): |
| 1733 | reader.read_next_batch() |
| 1734 | # EOF |
| 1735 | with pytest.raises(StopIteration): |
| 1736 | reader.read_next_batch() |
| 1737 | |
| 1738 | def test_invalid_csv(self): |
| 1739 | # CSV errors on first block |
nothing calls this directly
no test coverage detected