Skip to content

Commit 4d5e32c

Browse files
committed
Regression test for inverse indices in array_api set functions
Original NumPy Commit: ccc1091360639de76fab1c1e2a8b31fda81855fb
1 parent b4f2cdf commit 4d5e32c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import pytest
2+
from hypothesis import given
3+
from hypothesis.extra.array_api import make_strategies_namespace
4+
5+
import array_api_strict as xp
6+
7+
xps = make_strategies_namespace(xp)
8+
9+
10+
@pytest.mark.parametrize("func", [xp.unique_all, xp.unique_inverse])
11+
@given(xps.arrays(dtype=xps.scalar_dtypes(), shape=xps.array_shapes()))
12+
def test_inverse_indices_shape(func, x):
13+
"""
14+
Inverse indices share shape of input array
15+
16+
See https://github.com/numpy/numpy/issues/20638
17+
"""
18+
out = func(x)
19+
assert out.inverse_indices.shape == x.shape

0 commit comments

Comments
 (0)