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

Method test_in1d_invert

numpy/lib/tests/test_arraysetops.py:331–349  ·  view source on GitHub ↗

Test in1d's invert parameter

(self, kind)

Source from the content-addressed store, hash-verified

329
330 @pytest.mark.parametrize("kind", [None, "sort", "table"])
331 def test_in1d_invert(self, kind):
332 "Test in1d's invert parameter"
333 # We use two different sizes for the b array here to test the
334 # two different paths in in1d().
335 for mult in (1, 10):
336 a = np.array([5, 4, 5, 3, 4, 4, 3, 4, 3, 5, 2, 1, 5, 5])
337 b = [2, 3, 4] * mult
338 assert_array_equal(np.invert(in1d(a, b, kind=kind)),
339 in1d(a, b, invert=True, kind=kind))
340
341 # float:
342 if kind in {None, "sort"}:
343 for mult in (1, 10):
344 a = np.array([5, 4, 5, 3, 4, 4, 3, 4, 3, 5, 2, 1, 5, 5],
345 dtype=np.float32)
346 b = [2, 3, 4] * mult
347 b = np.array(b, dtype=np.float32)
348 assert_array_equal(np.invert(in1d(a, b, kind=kind)),
349 in1d(a, b, invert=True, kind=kind))
350
351 @pytest.mark.parametrize("kind", [None, "sort", "table"])
352 def test_in1d_ravel(self, kind):

Callers

nothing calls this directly

Calls 2

assert_array_equalFunction · 0.90
in1dFunction · 0.90

Tested by

no test coverage detected