diff --git a/ome_zarr/utils.py b/ome_zarr/utils.py index 086ede3d..c929c283 100644 --- a/ome_zarr/utils.py +++ b/ome_zarr/utils.py @@ -129,7 +129,9 @@ def download(input_path: str, output_dir: str = ".") -> None: for dataset, data in reversed(list(zip(datasets, resolutions))): LOGGER.info("resolution %s...", dataset) with pbar: - data.to_zarr(str(target_path / dataset)) + data.to_zarr( + str(target_path / dataset), dimension_separator="/" + ) else: # Assume a group that needs metadata, like labels zarr.group(str(target_path)) diff --git a/tests/test_cli.py b/tests/test_cli.py index cd60e6cf..b38aba46 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -8,6 +8,16 @@ from ome_zarr.utils import strip_common_prefix +def directory_items(directory: Path): + """ + Get all items (files and folders) in a directory, relative to that directory. + """ + if not directory.is_dir(): + raise ValueError(f"{directory} is not a directory") + + return sorted([p.relative_to(directory) for p in directory.glob("*")]) + + class TestCli: @pytest.fixture(autouse=True) def initdir(self, tmpdir): @@ -40,6 +50,24 @@ def test_astronaut_download(self, tmpdir): main(["download", filename, f"--output={out}"]) main(["info", f"{out}/{basename}"]) + assert directory_items(Path(out) / "data-3") == [ + Path(".zattrs"), + Path(".zgroup"), + Path("0"), + Path("1"), + Path("2"), + Path("3"), + Path("4"), + Path("labels"), + ] + + assert directory_items(Path(out) / "data-3" / "1") == [ + Path(".zarray"), + Path("0"), + Path("1"), + Path("2"), + ] + def test_s3_info(self, s3_address): main(["info", s3_address])