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:172–193  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

170
171
172def test_read_table_without_dataset(tempdir):
173 from unittest import mock
174
175 class MockParquetDataset:
176 def __init__(self, *args, **kwargs):
177 raise ImportError("MockParquetDataset")
178
179 path = tempdir / "test.parquet"
180 table = pa.table({"a": [1, 2, 3]})
181 _write_table(table, path)
182
183 with mock.patch('pyarrow.parquet.core.ParquetDataset', new=MockParquetDataset):
184 with pytest.raises(ValueError, match="the 'filters' keyword"):
185 pq.read_table(path, filters=[('integer', '=', 1)])
186 with pytest.raises(ValueError, match="the 'partitioning' keyword"):
187 pq.read_table(path, partitioning=['week', 'color'])
188 with pytest.raises(ValueError, match="the 'schema' argument"):
189 pq.read_table(path, schema=table.schema)
190 with pytest.raises(ValueError, match="the 'source' argument"):
191 pq.read_table(tempdir)
192 result = pq.read_table(path)
193 assert result == table
194
195
196@pytest.mark.slow

Callers

nothing calls this directly

Calls 2

_write_tableFunction · 0.90
read_tableMethod · 0.45

Tested by

no test coverage detected