(dataset, base_dir, expected_files, sort_col,
base_dir_path=None, partitioning=None)
| 4197 | |
| 4198 | |
| 4199 | def _check_dataset_roundtrip(dataset, base_dir, expected_files, sort_col, |
| 4200 | base_dir_path=None, partitioning=None): |
| 4201 | base_dir_path = base_dir_path or base_dir |
| 4202 | |
| 4203 | ds.write_dataset(dataset, base_dir, format="arrow", |
| 4204 | partitioning=partitioning, use_threads=False) |
| 4205 | |
| 4206 | # check that all files are present |
| 4207 | file_paths = list(base_dir_path.rglob("*")) |
| 4208 | assert set(file_paths) == set(expected_files) |
| 4209 | |
| 4210 | # check that reading back in as dataset gives the same result |
| 4211 | dataset2 = ds.dataset( |
| 4212 | base_dir_path, format="arrow", partitioning=partitioning) |
| 4213 | |
| 4214 | assert _sort_table(dataset2.to_table(), sort_col).equals( |
| 4215 | _sort_table(dataset.to_table(), sort_col)) |
| 4216 | |
| 4217 | |
| 4218 | @pytest.mark.parquet |
no test coverage detected