Skip to content

Commit de84391

Browse files
committed
test group creation too
1 parent f342bb9 commit de84391

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

tests/test_group.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ def test_group_create_array(
659659
a[:] = data
660660

661661
assert array.path == normalize_path(name)
662-
assert array.name == "/" + normalize_path(name)
662+
assert array.name == "/" + array.path
663663
assert array.shape == shape
664664
assert array.dtype == np.dtype(dtype)
665665
assert np.array_equal(array[:], data)
@@ -950,20 +950,23 @@ async def test_asyncgroup_delitem(store: Store, zarr_format: ZarrFormat) -> None
950950
raise AssertionError
951951

952952

953+
@pytest.mark.parametrize("name", ["a", "/a"])
953954
async def test_asyncgroup_create_group(
954955
store: Store,
956+
name: str,
955957
zarr_format: ZarrFormat,
956958
) -> None:
957959
agroup = await AsyncGroup.from_store(store=store, zarr_format=zarr_format)
958-
sub_node_path = "sub_group"
959960
attributes = {"foo": 999}
960-
subnode = await agroup.create_group(name=sub_node_path, attributes=attributes)
961-
962-
assert isinstance(subnode, AsyncGroup)
963-
assert subnode.attrs == attributes
964-
assert subnode.store_path.path == sub_node_path
965-
assert subnode.store_path.store == store
966-
assert subnode.metadata.zarr_format == zarr_format
961+
subgroup = await agroup.create_group(name=name, attributes=attributes)
962+
963+
assert isinstance(subgroup, AsyncGroup)
964+
assert subgroup.path == normalize_path(name)
965+
assert subgroup.name == "/" + subgroup.path
966+
assert subgroup.attrs == attributes
967+
assert subgroup.store_path.path == subgroup.path
968+
assert subgroup.store_path.store == store
969+
assert subgroup.metadata.zarr_format == zarr_format
967970

968971

969972
async def test_asyncgroup_create_array(

0 commit comments

Comments
 (0)