MCPcopy
hub / github.com/numpy/numpy / test_isin_timedelta

Method test_isin_timedelta

numpy/lib/tests/test_arraysetops.py:395–403  ·  view source on GitHub ↗

Test that isin works for timedelta input

(self, kind)

Source from the content-addressed store, hash-verified

393
394 @pytest.mark.parametrize("kind", [None, "sort"])
395 def test_isin_timedelta(self, kind):
396 """Test that isin works for timedelta input"""
397 rstate = np.random.RandomState(0)
398 a = rstate.randint(0, 100, size=10)
399 b = rstate.randint(0, 100, size=10)
400 truth = isin(a, b)
401 a_timedelta = a.astype("timedelta64[s]")
402 b_timedelta = b.astype("timedelta64[s]")
403 assert_array_equal(truth, isin(a_timedelta, b_timedelta, kind=kind))
404
405 def test_isin_table_timedelta_fails(self):
406 a = np.array([0, 1, 2], dtype="timedelta64[s]")

Callers

nothing calls this directly

Calls 3

isinFunction · 0.90
assert_array_equalFunction · 0.90
astypeMethod · 0.80

Tested by

no test coverage detected