Skip to content

Commit 1e96600

Browse files
maxrjonesd-v-b
andcommitted
Test for contains group/array at multiple heirarchies
Co-authored-by: Davis Bennett <[email protected]>
1 parent c8ebcd0 commit 1e96600

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tests/test_store/test_core.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,35 @@
1111
from zarr.storage._utils import normalize_path
1212

1313

14+
@pytest.mark.parametrize("path", ["foo", "foo/bar"])
1415
@pytest.mark.parametrize("write_group", [True, False])
1516
@pytest.mark.parametrize("zarr_format", [2, 3])
16-
async def test_contains_group(local_store, write_group: bool, zarr_format: ZarrFormat) -> None:
17+
async def test_contains_group(
18+
local_store, path: str, write_group: bool, zarr_format: ZarrFormat
19+
) -> None:
1720
"""
1821
Test that the contains_group method correctly reports the existence of a group.
1922
"""
2023
root = Group.from_store(store=local_store, zarr_format=zarr_format)
2124
if write_group:
22-
root.create_group("foo")
23-
store_path = StorePath(local_store, path="foo")
25+
root.create_group(path)
26+
store_path = StorePath(local_store, path=path)
2427
assert await contains_group(store_path, zarr_format=zarr_format) == write_group
2528

2629

30+
@pytest.mark.parametrize("path", ["foo", "foo/bar"])
2731
@pytest.mark.parametrize("write_array", [True, False])
2832
@pytest.mark.parametrize("zarr_format", [2, 3])
29-
async def test_contains_array(local_store, write_array: bool, zarr_format: ZarrFormat) -> None:
33+
async def test_contains_array(
34+
local_store, path: str, write_array: bool, zarr_format: ZarrFormat
35+
) -> None:
3036
"""
3137
Test that the contains array method correctly reports the existence of an array.
3238
"""
3339
root = Group.from_store(store=local_store, zarr_format=zarr_format)
3440
if write_array:
35-
root.create_array("foo", shape=(100,), chunks=(10,), dtype="i4")
36-
store_path = StorePath(local_store, path="foo")
41+
root.create_array(path, shape=(100,), chunks=(10,), dtype="i4")
42+
store_path = StorePath(local_store, path=path)
3743
assert await contains_array(store_path, zarr_format=zarr_format) == write_array
3844

3945

0 commit comments

Comments
 (0)