Skip to content

Commit 3db170a

Browse files
committed
ENH: add test for isin with scalars
1 parent 4ba25b6 commit 3db170a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

array_api_tests/test_set_functions.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,22 @@ def test_isin(x1, x2, kw):
277277
except Exception as exc:
278278
ph.add_note(exc, repro_snippet)
279279
raise
280+
281+
282+
@given(
283+
x1x2=hh.array_and_py_scalar(dh.all_dtypes),
284+
kw=hh.kwargs(invert=st.booleans())
285+
)
286+
def test_isin_scalars(x1x2, kw):
287+
x1, x2 = x1x2
288+
289+
repro_snippet = ph.format_snippet(f"xp.isin({x1!r}, {x2!r}, **kw) with {kw = }")
290+
try:
291+
out = xp.isin(x1, x2, **kw)
292+
293+
assert out.dtype == xp.bool
294+
assert out.shape == () if isinstance(x1, bool | int | float | complex) else x1.shape
295+
# TODO value tests
296+
except Exception as exc:
297+
ph.add_note(exc, repro_snippet)
298+
raise

0 commit comments

Comments
 (0)