Skip to content

Commit b246af4

Browse files
committed
avoid inserting order for v3 arrays in _like_args
1 parent ac9682a commit b246af4

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/zarr/api/asynchronous.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@
5252
if TYPE_CHECKING:
5353
from collections.abc import Iterable
5454

55-
import numcodecs
56-
5755
from zarr.abc.codec import Codec
5856
from zarr.abc.numcodec import Numcodec
5957
from zarr.core.buffer import NDArrayLikeOrScalar
@@ -128,11 +126,11 @@ def _get_shape_chunks(a: ArrayLike | Any) -> tuple[tuple[int, ...] | None, tuple
128126

129127

130128
class _LikeArgs(TypedDict):
131-
shape: NotRequired[ChunkCoords]
132-
chunks: NotRequired[ChunkCoords]
129+
shape: NotRequired[tuple[int, ...]]
130+
chunks: NotRequired[tuple[int, ...]]
133131
dtype: NotRequired[np.dtype[np.generic]]
134132
order: NotRequired[Literal["C", "F"]]
135-
filters: NotRequired[tuple[numcodecs.abc.Codec, ...] | None]
133+
filters: NotRequired[tuple[Numcodec, ...] | None]
136134
compressor: NotRequired[CompressorLikev2]
137135
codecs: NotRequired[tuple[Codec, ...]]
138136

@@ -151,9 +149,9 @@ def _like_args(a: ArrayLike) -> _LikeArgs:
151149
if hasattr(a, "dtype"):
152150
new["dtype"] = a.dtype
153151

154-
if isinstance(a, AsyncArray):
155-
new["order"] = a.order
152+
if isinstance(a, AsyncArray | Array):
156153
if isinstance(a.metadata, ArrayV2Metadata):
154+
new["order"] = a.order
157155
new["compressor"] = a.metadata.compressor
158156
new["filters"] = a.metadata.filters
159157
else:

tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ async def test_array_like_creation(
160160
else:
161161
expect_dtype = ref_arr.dtype # type: ignore[assignment]
162162

163-
new_arr = await func(ref_arr, path="foo", **kwargs) # type: ignore[call-arg]
163+
new_arr = await func(ref_arr, path="foo", zarr_format=zarr_format, **kwargs) # type: ignore[call-arg]
164164
assert new_arr.shape == expect_shape
165165
assert new_arr.chunks == expect_chunks
166166
assert new_arr.dtype == expect_dtype

tests/test_api/test_asynchronous.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_like_args(
8888
"""
8989
Test the like_args function
9090
"""
91-
assert _like_args(observed, {}) == expected
91+
assert _like_args(observed) == expected
9292

9393

9494
async def test_open_no_array() -> None:

0 commit comments

Comments
 (0)