8000 Regression test for inverse indices in `array_api` set functions · numpy/numpy@5420bb2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5420bb2

Browse files
committed
Regression test for inverse indices in array_api set functions
1 parent 232bf8e commit 5420bb2

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+
from numpy import array_api 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)
0