Skip to content

Commit 01ac722

Browse files
committed
add test for indexing with zarr array
1 parent 6fa9f37 commit 01ac722

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_indexing.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,22 @@ async def test_async_oindex(self, store, indexer, expected):
20412041
result = await async_zarr.oindex.getitem(indexer)
20422042
assert_array_equal(result, expected)
20432043

2044+
@pytest.mark.asyncio
2045+
async def test_async_oindex_with_zarr_array(self, store):
2046+
z1 = zarr.create_array(store=store, shape=(2, 2), chunks=(1, 1), zarr_format=3, dtype="i8")
2047+
z1[...] = np.array([[1, 2], [3, 4]])
2048+
async_zarr = z1._async_array
2049+
2050+
# create boolean zarr array to index with
2051+
z2 = zarr.create_array(
2052+
store=store, name="z2", shape=(2,), chunks=(1,), zarr_format=3, dtype="?"
2053+
)
2054+
z2[...] = np.array([True, False])
2055+
2056+
result = await async_zarr.oindex.getitem(z2)
2057+
expected = np.array([[1, 2]])
2058+
assert_array_equal(result, expected)
2059+
20442060
@pytest.mark.parametrize(
20452061
("indexer", "expected"),
20462062
[

0 commit comments

Comments
 (0)