Skip to content

Commit 71067ba

Browse files
committed
minor changes from review
1 parent f62fe31 commit 71067ba

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

src/zarr/storage/_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ async def make_store(
321321
_read_only = mode == "r"
322322

323323
if isinstance(store_like, StorePath):
324-
# Already a StorePath
324+
# Get underlying store
325325
return store_like.store
326326

327327
elif isinstance(store_like, Store):

tests/test_cli/test_migrate_v3.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
from zarr.core.chunk_key_encodings import V2ChunkKeyEncoding
2222
from zarr.core.common import JSON, ZarrFormat
2323
from zarr.core.dtype.npy.int import UInt8, UInt16
24-
from zarr.core.group import Group
24+
from zarr.core.group import Group, GroupMetadata
25+
from zarr.core.metadata.v3 import ArrayV3Metadata
2526
from zarr.storage._local import LocalStore
2627

2728
typer_testing = pytest.importorskip(
@@ -56,21 +57,22 @@ def test_migrate_array(local_store: LocalStore) -> None:
5657
assert (local_store.root / "zarr.json").exists()
5758

5859
zarr_array = zarr.open(local_store.root, zarr_format=3)
59-
metadata = zarr_array.metadata
60-
assert metadata.zarr_format == 3
61-
assert metadata.node_type == "array"
62-
assert metadata.shape == shape
63-
assert metadata.chunk_grid == RegularChunkGrid(chunk_shape=chunks)
64-
assert metadata.chunk_key_encoding == V2ChunkKeyEncoding(separator=".")
65-
assert metadata.data_type == UInt16(endianness="little")
66-
assert metadata.codecs == (
67-
BytesCodec(endian="little"),
68-
BloscCodec(typesize=2, cname="zstd", clevel=3, shuffle="shuffle", blocksize=0),
60+
61+
expected_metadata = ArrayV3Metadata(
62+
shape=shape,
63+
data_type=UInt16(endianness="little"),
64+
chunk_grid=RegularChunkGrid(chunk_shape=chunks),
65+
chunk_key_encoding=V2ChunkKeyEncoding(separator="."),
66+
fill_value=fill_value,
67+
codecs=(
68+
BytesCodec(endian="little"),
69+
BloscCodec(typesize=2, cname="zstd", clevel=3, shuffle="shuffle", blocksize=0),
70+
),
71+
attributes=attributes,
72+
dimension_names=None,
73+
storage_transformers=None,
6974
)
70-
assert metadata.fill_value == fill_value
71-
assert metadata.attributes == attributes
72-
assert metadata.dimension_names is None
73-
assert metadata.storage_transformers == ()
75+
assert zarr_array.metadata == expected_metadata
7476

7577

7678
def test_migrate_group(local_store: LocalStore) -> None:
@@ -82,11 +84,10 @@ def test_migrate_group(local_store: LocalStore) -> None:
8284
assert (local_store.root / "zarr.json").exists()
8385

8486
zarr_array = zarr.open(local_store.root, zarr_format=3)
85-
metadata = zarr_array.metadata
86-
assert metadata.zarr_format == 3
87-
assert metadata.node_type == "group"
88-
assert metadata.attributes == attributes
89-
assert metadata.consolidated_metadata is None
87+
expected_metadata = GroupMetadata(
88+
attributes=attributes, zarr_format=3, consolidated_metadata=None
89+
)
90+
assert zarr_array.metadata == expected_metadata
9091

9192

9293
@pytest.mark.parametrize("separator", [".", "/"])

0 commit comments

Comments
 (0)