Skip to content

Commit 6fbb6b1

Browse files
committed
test vindexing with zarr array
1 parent 1469093 commit 6fbb6b1

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
@@ -2074,6 +2074,22 @@ async def test_async_vindex(self, store, indexer, expected):
20742074
result = await async_zarr.vindex.getitem(indexer)
20752075
assert_array_equal(result, expected)
20762076

2077+
@pytest.mark.asyncio
2078+
async def test_async_vindex_with_zarr_array(self, store):
2079+
z1 = zarr.create_array(store=store, shape=(2, 2), chunks=(1, 1), zarr_format=3, dtype="i8")
2080+
z1[...] = np.array([[1, 2], [3, 4]])
2081+
async_zarr = z1._async_array
2082+
2083+
# create boolean zarr array to index with
2084+
z2 = zarr.create_array(
2085+
store=store, name="z2", shape=(2, 2), chunks=(1, 1), zarr_format=3, dtype="?"
2086+
)
2087+
z2[...] = np.array([[False, True], [False, True]])
2088+
2089+
result = await async_zarr.vindex.getitem(z2)
2090+
expected = np.array([2, 4])
2091+
assert_array_equal(result, expected)
2092+
20772093
@pytest.mark.asyncio
20782094
async def test_async_invalid_indexer(self, store):
20792095
z = zarr.create_array(store=store, shape=(2, 2), chunks=(1, 1), zarr_format=3, dtype="i8")

0 commit comments

Comments
 (0)