(tempdir, dataset_reader)
| 3629 | |
| 3630 | @pytest.mark.pandas |
| 3631 | def test_json_fragment_options(tempdir, dataset_reader): |
| 3632 | table = pa.table({'a': pa.array([1, 2, 3], type="int64"), |
| 3633 | 'b': pa.array([.1, .2, .3], type="float64")}) |
| 3634 | |
| 3635 | path = str(tempdir / 'test.json') |
| 3636 | out = table.to_pandas().to_json(orient='records')[1:-1].replace('},{', '}\n{') |
| 3637 | with open(path, 'w') as f: |
| 3638 | f.write(out) |
| 3639 | |
| 3640 | with pytest.raises(ValueError, |
| 3641 | match="try to increase block size"): |
| 3642 | options = ds.JsonFragmentScanOptions( |
| 3643 | read_options=pa.json.ReadOptions(block_size=4)) |
| 3644 | dataset = ds.dataset(path, format=ds.JsonFileFormat(options)) |
| 3645 | |
| 3646 | options = ds.JsonFragmentScanOptions( |
| 3647 | read_options=pa.json.ReadOptions(block_size=64)) |
| 3648 | dataset = ds.dataset(path, format=ds.JsonFileFormat(options)) |
| 3649 | result = dataset_reader.to_table(dataset) |
| 3650 | assert result.equals(table) |
| 3651 | |
| 3652 | |
| 3653 | def test_encoding(tempdir, dataset_reader): |
nothing calls this directly
no test coverage detected