Skip to content

Commit 3c4a21a

Browse files
committed
fix tests after rebasing
1 parent d809d32 commit 3c4a21a

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

src/stack_to_chunk/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing import Any, Literal
88

99
import dask.array as da
10+
import numpy as np
1011
import zarr
1112
from dask.array.core import Array
1213
from loguru import logger

src/stack_to_chunk/tests/test_main.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ def test_workflow(tmp_path: Path, arr: da.Array) -> None:
7070
compressor=compressor,
7171
)
7272

73-
assert len(multiscales["datasets"]) == 1
74-
level_0 = multiscales["datasets"][0]
75-
assert all(k in level_0 for k in ["path", "coordinateTransformations"])
76-
7773
assert group.levels == [0]
7874
zarr_arr = zarr.open(zarr_path / "0")
7975
assert zarr_arr.chunks == (chunk_size, chunk_size, chunk_size)
@@ -94,7 +90,14 @@ def test_workflow(tmp_path: Path, arr: da.Array) -> None:
9490
{"name": "y", "type": "space", "unit": "centimeter"},
9591
{"name": "x", "type": "space", "unit": "centimeter"},
9692
],
97-
"datasets": [],
93+
"datasets": [
94+
{
95+
"path": "0",
96+
"coordinateTransformations": [
97+
{"type": "scale", "scale": [3.0, 4.0, 5.0]}
98+
],
99+
}
100+
],
98101
"metadata": {"description": "Downscaled using linear resampling"},
99102
"name": "my_zarr_group",
100103
"type": "linear",
@@ -106,13 +109,20 @@ def test_workflow(tmp_path: Path, arr: da.Array) -> None:
106109
data = json.load(f)
107110
assert data == {"zarr_format": 2}
108111

112+
# Check that adding a downsample level works
109113
group.add_downsample_level(1)
110114
assert group.levels == [0, 1]
111-
assert len(multiscales["datasets"]) == 2
112-
for level in multiscales["datasets"]:
113-
assert all(k in level for k in ["path", "coordinateTransformations"])
114-
115-
zarr_arr_1 = zarr.open(tmp_path / "group.zarr" / "1")
115+
assert multiscales["datasets"] == [
116+
{
117+
"path": "0",
118+
"coordinateTransformations": [{"type": "scale", "scale": [3.0, 4.0, 5.0]}],
119+
},
120+
{
121+
"path": "1",
122+
"coordinateTransformations": [{"type": "scale", "scale": [6.0, 8.0, 10.0]}],
123+
},
124+
]
125+
zarr_arr_1 = zarr.open(zarr_path / "1")
116126
shape_1 = (292, 123, 78)
117127
assert zarr_arr_1.chunks == zarr_arr.chunks
118128
assert zarr_arr_1.shape == shape_1

0 commit comments

Comments
 (0)