Skip to content

Commit 8af66e7

Browse files
committed
Address failing tests
1 parent a4d8113 commit 8af66e7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/zarr/api/asynchronous.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,11 @@ async def open(
225225
if path is not None:
226226
store_path = store_path / path
227227

228-
if "shape" not in kwargs:
229-
return await open_group(store=store_path, zarr_format=zarr_format, mode=mode, **kwargs)
228+
if "shape" not in kwargs and mode in {"a", "w", "w-"}:
229+
try:
230+
return await open_group(store=store_path, zarr_format=zarr_format, mode=mode, **kwargs)
231+
except AssertionError:
232+
return await open_array(store=store_path, zarr_format=zarr_format, mode=mode, **kwargs)
230233
try:
231234
return await open_array(store=store_path, zarr_format=zarr_format, mode=mode, **kwargs)
232235
except KeyError:

tests/v3/test_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,11 @@ def test_open_with_mode_r_plus(tmp_path: pathlib.Path) -> None:
116116
z2[:] = 3
117117

118118

119-
def test_open_with_mode_a(tmp_path: pathlib.Path) -> None:
119+
async def test_open_with_mode_a(tmp_path: pathlib.Path) -> None:
120120
# Open without shape argument should default to group
121121
g = zarr.open(store=tmp_path, mode="a")
122122
assert isinstance(g, Group)
123+
await g.store_path.delete()
123124

124125
# 'a' means read/write (create if doesn't exist)
125126
arr = zarr.open(store=tmp_path, mode="a", shape=(3, 3))

0 commit comments

Comments
 (0)