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

Function test_read_table_without_dataset

python/pyarrow/tests/parquet/test_basic.py:189–210  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

187
188
189def test_read_table_without_dataset(tempdir):
190 from unittest import mock
191
192 class MockParquetDataset:
193 def __init__(self, *args, **kwargs):
194 raise ImportError("MockParquetDataset")
195
196 path = tempdir / "test.parquet"
197 table = pa.table({"a": [1, 2, 3]})
198 _write_table(table, path)
199
200 with mock.patch('pyarrow.parquet.core.ParquetDataset', new=MockParquetDataset):
201 with pytest.raises(ValueError, match="the 'filters' keyword"):
202 pq.read_table(path, filters=[('integer', '=', 1)])
203 with pytest.raises(ValueError, match="the 'partitioning' keyword"):
204 pq.read_table(path, partitioning=['week', 'color'])
205 with pytest.raises(ValueError, match="the 'schema' argument"):
206 pq.read_table(path, schema=table.schema)
207 with pytest.raises(ValueError, match="the 'source' argument"):
208 pq.read_table(tempdir)
209 result = pq.read_table(path)
210 assert result == table
211
212
213@pytest.mark.slow

Callers

nothing calls this directly

Calls 2

_write_tableFunction · 0.90
read_tableMethod · 0.45

Tested by

no test coverage detected