diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2022-06-09 11:55:32 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-09 11:55:32 -0600 |
commit | 5ea81775e0d2d13a4fec6bab882002e050bd3da1 (patch) | |
tree | d2dc068c7c06c22393841ddc0dd7ee011996249f /numpy/array_api/tests/test_set_functions.py | |
parent | 9d6b102617a92ad41964a5611c8dec87d3053a9f (diff) | |
parent | 5447192c8dc5d43d837b93ed5c5d47457e367669 (diff) | |
download | numpy-5ea81775e0d2d13a4fec6bab882002e050bd3da1.tar.gz |
Merge branch 'main' into bugfix_16492_segfault_on_pyfragments
Diffstat (limited to 'numpy/array_api/tests/test_set_functions.py')
-rw-r--r-- | numpy/array_api/tests/test_set_functions.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/numpy/array_api/tests/test_set_functions.py b/numpy/array_api/tests/test_set_functions.py new file mode 100644 index 000000000..b8eb65d43 --- /dev/null +++ b/numpy/array_api/tests/test_set_functions.py @@ -0,0 +1,19 @@ +import pytest +from hypothesis import given +from hypothesis.extra.array_api import make_strategies_namespace + +from numpy import array_api as xp + +xps = make_strategies_namespace(xp) + + +@pytest.mark.parametrize("func", [xp.unique_all, xp.unique_inverse]) +@given(xps.arrays(dtype=xps.scalar_dtypes(), shape=xps.array_shapes())) +def test_inverse_indices_shape(func, x): + """ + Inverse indices share shape of input array + + See https://github.com/numpy/numpy/issues/20638 + """ + out = func(x) + assert out.inverse_indices.shape == x.shape |