MCPcopy Create free account
hub / github.com/numpy/numpy / test_intersect1d

Method test_intersect1d

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

intersect1dFunction · 0.90
assert_array_equalFunction · 0.90

Tested by

no test coverage detected