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