Skip to content

Commit 9d8ffee

Browse files
committed
Add property test
1 parent 8eeaaae commit 9d8ffee

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_properties.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from zarr.abc.store import Store
1414
from zarr.core.metadata import ArrayV2Metadata, ArrayV3Metadata
15+
from zarr.core.sync import sync
1516
from zarr.testing.strategies import (
1617
array_metadata,
1718
arrays,
@@ -30,6 +31,18 @@ def test_roundtrip(data: st.DataObject, zarr_format: int) -> None:
3031
assert_array_equal(nparray, zarray[:])
3132

3233

34+
@given(array=arrays())
35+
def test_array_creates_implicit_groups(array):
36+
path = array.path
37+
ancestry = path.split("/")[:-1]
38+
for i in range(len(ancestry)):
39+
parent = "/".join(ancestry[: i + 1])
40+
if array.metadata.zarr_format == 2:
41+
sync(array.store.get(f"{parent}/.zgroup", prototype=default_buffer_prototype()))
42+
elif array.metadata.zarr_format == 3:
43+
sync(array.store.get(f"{parent}/zarr.json", prototype=default_buffer_prototype()))
44+
45+
3346
@given(data=st.data())
3447
def test_basic_indexing(data: st.DataObject) -> None:
3548
zarray = data.draw(arrays())

0 commit comments

Comments
 (0)