(tempdir, dataset_reader)
| 3608 | |
| 3609 | @pytest.mark.pandas |
| 3610 | def test_json_format_options(tempdir, dataset_reader): |
| 3611 | table = pa.table({'a': pa.array([1, 2, 3], type="int64"), |
| 3612 | 'b': pa.array([.1, .2, .3], type="float64")}) |
| 3613 | |
| 3614 | path = str(tempdir / 'test.json') |
| 3615 | out = table.to_pandas().to_json(orient='records')[1:-1].replace('},{', '}\n{') |
| 3616 | with open(path, 'w') as f: |
| 3617 | f.write(out) |
| 3618 | |
| 3619 | with pytest.raises(ValueError, |
| 3620 | match="try to increase block size"): |
| 3621 | dataset = ds.dataset(path, format=ds.JsonFileFormat( |
| 3622 | read_options=pa.json.ReadOptions(block_size=4))) |
| 3623 | |
| 3624 | dataset = ds.dataset(path, format=ds.JsonFileFormat( |
| 3625 | read_options=pa.json.ReadOptions(block_size=64))) |
| 3626 | result = dataset_reader.to_table(dataset) |
| 3627 | assert result.equals(table) |
| 3628 | |
| 3629 | |
| 3630 | @pytest.mark.pandas |
nothing calls this directly
no test coverage detected