MCPcopy Index your code
hub / github.com/numpy/numpy / test_isin_invert

Method test_isin_invert

numpy/lib/tests/test_arraysetops.py:347–365  ·  view source on GitHub ↗

Test isin's invert parameter

(self, kind)

Source from the content-addressed store, hash-verified

345
346 @pytest.mark.parametrize("kind", [None, "sort", "table"])
347 def test_isin_invert(self, kind):
348 "Test isin's invert parameter"
349 # We use two different sizes for the b array here to test the
350 # two different paths in isin().
351 for mult in (1, 10):
352 a = np.array([5, 4, 5, 3, 4, 4, 3, 4, 3, 5, 2, 1, 5, 5])
353 b = [2, 3, 4] * mult
354 assert_array_equal(np.invert(isin(a, b, kind=kind)),
355 isin(a, b, invert=True, kind=kind))
356
357 # float:
358 if kind in {None, "sort"}:
359 for mult in (1, 10):
360 a = np.array([5, 4, 5, 3, 4, 4, 3, 4, 3, 5, 2, 1, 5, 5],
361 dtype=np.float32)
362 b = [2, 3, 4] * mult
363 b = np.array(b, dtype=np.float32)
364 assert_array_equal(np.invert(isin(a, b, kind=kind)),
365 isin(a, b, invert=True, kind=kind))
366
367 def test_isin_hit_alternate_algorithm(self):
368 """Hit the standard isin code with integers"""

Callers

nothing calls this directly

Calls 2

assert_array_equalFunction · 0.90
isinFunction · 0.90

Tested by

no test coverage detected