Skip to content

Commit 2e48a8b

Browse files
committed
test: explicitly test both group and array - also reload
1 parent deb3230 commit 2e48a8b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tests/test_attributes.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import pytest
2+
13
import zarr.core
24
import zarr.core.attributes
35
import zarr.storage
@@ -61,11 +63,20 @@ def test_update_no_changes() -> None:
6163
assert dict(z.attrs) == {"a": [], "b": 3}
6264

6365

64-
def test_del_works() -> None:
66+
@pytest.mark.parametrize("group", [True, False])
67+
def test_del_works(group: bool) -> None:
6568
store = zarr.storage.MemoryStore()
66-
z = zarr.create(10, store=store, overwrite=True)
69+
if group:
70+
z = zarr.create_group(store)
71+
else:
72+
z = zarr.create_array(store=store, shape=10, dtype=int)
6773
assert dict(z.attrs) == {}
6874
z.update_attributes({"a": [3, 4], "c": 4})
6975
del z.attrs["a"]
70-
assert "a" not in z.attrs
71-
assert "c" in z.attrs
76+
assert dict(z.attrs) == {"c": 4}
77+
78+
if group:
79+
z2 = zarr.open_group(store)
80+
else:
81+
z2 = zarr.open_array(store)
82+
assert dict(z2.attrs) == {"c": 4}

0 commit comments

Comments
 (0)