Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions array_api_tests/_array_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def __repr__(self):
_funcs += ["take", "isdtype", "conj", "imag", "real"] # TODO: bump spec and update array-api-tests to new spec layout
_top_level_attrs = _dtypes + _constants + _funcs + stubs.EXTENSIONS + ["fft"]

_top_level_attrs += ['isin'] # FIXME: until the spec is not updated
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove before merging


for attr in _top_level_attrs:
try:
globals()[attr] = getattr(xp, attr)
Expand Down
21 changes: 21 additions & 0 deletions array_api_tests/test_set_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pytest
from hypothesis import assume, given
from hypothesis import strategies as st

from . import _array_module as xp
from . import dtype_helpers as dh
Expand Down Expand Up @@ -256,3 +257,23 @@ def test_unique_values(x):
except Exception as exc:
ph.add_note(exc, repro_snippet)
raise


@given(
*hh.two_mutual_arrays(two_shapes=st.tuples(hh.shapes(), hh.shapes())),
hh.kwargs(invert=st.booleans())
)
def test_isin(x1, x2, kw):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need @pytest.mark.min_version("2025.12")

print("\nx1 = ", type(x1))
print(x1.shape, x2.shape, x1.dtype, x2.dtype, kw)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug prints


repro_snippet = ph.format_snippet(f"xp.isin({x1!r}, {x2!r}, **kw) with {kw = }")
try:
out = xp.isin(x1, x2, **kw)

assert out.dtype == xp.bool
assert out.shape == x1.shape
# TODO value tests
except Exception as exc:
ph.add_note(exc, repro_snippet)
raise
Loading