Skip to content

Commit 63fcaf1

Browse files
committed
test: update zarr v3 conversion expectations
1 parent 7a156f2 commit 63fcaf1

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

tests/test_s2_multiscale.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
"""
22
Tests for S2 multiscale pyramid creation with xy-aligned sharding.
33
"""
4-
5-
from typing import TypedDict
6-
74
import numpy as np
85
import pytest
96
import xarray as xr
107
import zarr
118
from pydantic_zarr.experimental.v3 import ArraySpec, GroupSpec
129
from structlog.testing import capture_logs
10+
from typing_extensions import TypedDict
1311

1412
from eopf_geozarr.s2_optimization.s2_multiscale import (
1513
calculate_aligned_chunk_size,

tests/test_zarrio.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,5 +256,22 @@ def custom_array_encoder(key: str, metadata: ArrayV2Metadata) -> ArrayV3Metadata
256256
assert new_node.attrs.asdict() == old_node.attrs.asdict()
257257

258258

259-
if __name__ == "__main__":
260-
pytest.main([__file__])
259+
def test_reencode_group_omit_nodes_normalizes_leading_slash() -> None:
260+
group_v2 = zarr.create_group({}, zarr_format=2)
261+
group_v2.create_array("data", shape=(5,), dtype="int32")
262+
263+
group_v3 = reencode_group(group_v2, {}, "", omit_nodes=["/data"])
264+
265+
assert "data" not in group_v3
266+
267+
268+
def test_reencode_group_omit_nodes_is_prefix_safe() -> None:
269+
group_v2 = zarr.create_group({}, zarr_format=2)
270+
group_v2.create_array("foobar", shape=(5,), dtype="int32")
271+
group_v2.create_group("foo").create_array("child", shape=(5,), dtype="int32")
272+
273+
group_v3 = reencode_group(group_v2, {}, "", omit_nodes=["foo"])
274+
275+
assert "foo" not in group_v3
276+
assert "foo/child" not in group_v3
277+
assert "foobar" in group_v3

0 commit comments

Comments
 (0)