Skip to content

Commit d9878cf

Browse files
committed
add test for read
1 parent de280a7 commit d9878cf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_api.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
load,
2020
open,
2121
open_group,
22+
read,
2223
read_array,
2324
read_group,
2425
save,
@@ -52,6 +53,23 @@ def test_create(memory_store: Store) -> None:
5253
assert z.chunks == (40,)
5354

5455

56+
@pytest.mark.parametrize("store", ["memory"], indirect=True)
57+
def test_read(store: Store) -> None:
58+
"""
59+
Test that the polymorphic read function works.
60+
"""
61+
# create an array and a group
62+
_ = create_group(store=store, path="group", attributes={"node_type": "group"})
63+
_ = create_array(store=store, path="array", shape=(10, 10), attributes={"node_type": "array"})
64+
65+
group_r = read(store, path="group")
66+
assert group_r.attrs == {"node_type": "group"}
67+
68+
array_r = read(store, path="array")
69+
assert array_r.attrs == {"node_type": "array"}
70+
assert array_r.shape == (10, 10)
71+
72+
5573
# TODO: parametrize over everything this function takes
5674
@pytest.mark.parametrize("store", ["memory"], indirect=True)
5775
def test_create_array(store: Store) -> None:

0 commit comments

Comments
 (0)