MCPcopy Create free account
hub / github.com/apache/arrow / test_inference_failure

Method test_inference_failure

python/pyarrow/tests/test_csv.py:1718–1736  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

open_bytesMethod · 0.95
ReadOptionsClass · 0.90
lenFunction · 0.85
schemaMethod · 0.45

Tested by

no test coverage detected