Skip to content

Commit 67819a1

Browse files
Fixed path segment duplication in open_array (#2167)
Closes #2166
1 parent 8403438 commit 67819a1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Diff for: src/zarr/api/asynchronous.py

-1
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,6 @@ async def open_array(
897897
if store_path.store.mode.create:
898898
return await create(
899899
store=store_path,
900-
path=path,
901900
zarr_format=zarr_format,
902901
overwrite=store_path.store.mode.overwrite,
903902
**kwargs,

Diff for: src/zarr/testing/store.py

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import pytest
44

5+
import zarr.api.asynchronous
56
from zarr.abc.store import AccessMode, Store
67
from zarr.core.buffer import Buffer, default_buffer_prototype
78
from zarr.store._utils import _normalize_interval_index
@@ -232,3 +233,14 @@ async def test_list_dir(self, store: S) -> None:
232233
keys_observed = [k async for k in store.list_dir("group-0/group-1")]
233234
assert len(keys_expected) == len(keys_observed), keys_observed
234235
assert set(keys_observed) == set(keys_expected), keys_observed
236+
237+
async def test_set_get(self, store_kwargs: dict[str, Any]) -> None:
238+
kwargs = {**store_kwargs, **{"mode": "w"}}
239+
store = self.store_cls(**kwargs)
240+
await zarr.api.asynchronous.open_array(store=store, path="a", mode="w", shape=(4,))
241+
keys = [x async for x in store.list()]
242+
assert keys == ["a/zarr.json"]
243+
244+
# no errors
245+
await zarr.api.asynchronous.open_array(store=store, path="a", mode="r")
246+
await zarr.api.asynchronous.open_array(store=store, path="a", mode="a")

0 commit comments

Comments
 (0)