Skip to content

Commit 38578dd

Browse files
committed
test z[selection] for orthogonal selection
1 parent f648b61 commit 38578dd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/v3/test_indexing.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from zarr.buffer import BufferPrototype, NDBuffer
1616
from zarr.common import ChunkCoords
1717
from zarr.indexing import (
18+
is_pure_fancy_indexing,
1819
make_slice_selection,
1920
normalize_integer_selection,
2021
oindex,
@@ -520,6 +521,12 @@ def _test_get_orthogonal_selection(a, z, selection):
520521
actual = z.oindex[selection]
521522
assert_array_equal(expect, actual)
522523

524+
# if is not fancy indexing, z[selection] should be orthogonal selection
525+
selection_ndim = len(selection) if isinstance(selection, tuple) else 1
526+
if not is_pure_fancy_indexing(selection, selection_ndim):
527+
actual = z[selection]
528+
assert_array_equal(expect, actual)
529+
523530

524531
# noinspection PyStatementEffect
525532
def test_get_orthogonal_selection_1d_bool(store: StorePath):
@@ -1718,3 +1725,6 @@ def test_accessed_chunks(shape, chunks, ops):
17181725
) == 1
17191726
# Check that no other chunks were accessed
17201727
assert len(delta_counts) == 0
1728+
1729+
def test_is_pure_orthogonal_indexing():
1730+
pass

0 commit comments

Comments
 (0)