MCPcopy Index your code
hub / github.com/pydata/xarray / test_isin

Function test_isin

xarray/tests/test_dataarray.py:7001–7017  ·  view source on GitHub ↗
(da)

Source from the content-addressed store, hash-verified

6999
7000@pytest.mark.parametrize("da", ("repeating_ints",), indirect=True)
7001def test_isin(da) -> None:
7002 expected = DataArray(
7003 np.asarray([[0, 0, 0], [1, 0, 0]]),
7004 dims=list("yx"),
7005 coords={"x": list("abc"), "y": list("de")},
7006 ).astype("bool")
7007
7008 result = da.isin([3]).sel(y=list("de"), z=0)
7009 assert_equal(result, expected)
7010
7011 expected = DataArray(
7012 np.asarray([[0, 0, 1], [1, 0, 0]]),
7013 dims=list("yx"),
7014 coords={"x": list("abc"), "y": list("de")},
7015 ).astype("bool")
7016 result = da.isin([2, 3]).sel(y=list("de"), z=0)
7017 assert_equal(result, expected)
7018
7019
7020def test_raise_no_warning_for_nan_in_binary_ops() -> None:

Callers

nothing calls this directly

Calls 5

DataArrayClass · 0.90
assert_equalFunction · 0.90
isinMethod · 0.80
astypeMethod · 0.45
selMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…