MCPcopy
hub / github.com/numpy/numpy / test_intersect1d

Method test_intersect1d

numpy/lib/tests/test_arraysetops.py:20–36  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

18class TestSetOps:
19
20 def test_intersect1d(self):
21 # unique inputs
22 a = np.array([5, 7, 1, 2])
23 b = np.array([2, 4, 3, 1, 5])
24
25 ec = np.array([1, 2, 5])
26 c = intersect1d(a, b, assume_unique=True)
27 assert_array_equal(c, ec)
28
29 # non-unique inputs
30 a = np.array([5, 5, 7, 1, 2])
31 b = np.array([2, 1, 4, 3, 3, 1, 5])
32
33 ed = np.array([1, 2, 5])
34 c = intersect1d(a, b)
35 assert_array_equal(c, ed)
36 assert_array_equal([], intersect1d([], []))
37
38 def test_intersect1d_array_like(self):
39 # See gh-11772

Callers

nothing calls this directly

Calls 2

intersect1dFunction · 0.90
assert_array_equalFunction · 0.90

Tested by

no test coverage detected