Skip to content

Commit 0b7c4e7

Browse files
committed
TST: _utils.in1d: add tests
1 parent fadf701 commit 0b7c4e7

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

tests/test_funcs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import annotations
1+
from __future__ import annotations # https://github.com/pylint-dev/pylint/pull/9990
22

33
import contextlib
44
import typing
@@ -291,7 +291,7 @@ def test_setdiff1d(self):
291291
x2 = x1
292292
assert_equal(setdiff1d(x1, x2, xp=xp).dtype, xp.uint32)
293293

294-
def test_setdiff1d_unique(self):
294+
def test_assume_unique(self):
295295
x1 = xp.asarray([3, 2, 1])
296296
x2 = xp.asarray([7, 5, 2])
297297
expected = xp.asarray([3, 1])

tests/test_utils.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from __future__ import annotations # https://github.com/pylint-dev/pylint/pull/9990
2+
3+
# data-apis/array-api-strict#6
4+
import array_api_strict as xp # type: ignore[import-untyped] # pyright: ignore[reportMissingTypeStubs]
5+
from numpy.testing import assert_array_equal
6+
7+
from array_api_extra._lib._utils import in1d
8+
9+
10+
# some test coverage already provided by TestSetDiff1D
11+
class TestIn1D:
12+
def test_no_invert_assume_unique(self):
13+
x1 = xp.asarray([1, 2, 3])
14+
x2 = xp.asarray([3, 4, 5])
15+
expected = xp.asarray([False, False, True])
16+
actual = in1d(x1, x2, xp=xp)
17+
assert_array_equal(actual, expected)

tests/test_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import annotations
1+
from __future__ import annotations # https://github.com/pylint-dev/pylint/pull/9990
22

33
import importlib.metadata
44

0 commit comments

Comments
 (0)