MCPcopy
hub / github.com/pydata/xarray / test_isin

Function test_isin

xarray/tests/test_dataset.py:7805–7825  ·  view source on GitHub ↗
(test_elements, backend)

Source from the content-addressed store, hash-verified

7803
7804@pytest.mark.parametrize("test_elements", ([1, 2], np.array([1, 2]), DataArray([1, 2])))
7805def test_isin(test_elements, backend) -> None:
7806 expected = Dataset(
7807 data_vars={
7808 "var1": (("dim1",), [0, 1]),
7809 "var2": (("dim1",), [1, 1]),
7810 "var3": (("dim1",), [0, 1]),
7811 }
7812 ).astype("bool")
7813
7814 if backend == "dask":
7815 expected = expected.chunk()
7816
7817 result = Dataset(
7818 data_vars={
7819 "var1": (("dim1",), [0, 1]),
7820 "var2": (("dim1",), [1, 2]),
7821 "var3": (("dim1",), [0, 1]),
7822 }
7823 ).isin(test_elements)
7824
7825 assert_equal(result, expected)
7826
7827
7828def test_isin_dataset() -> None:

Callers

nothing calls this directly

Calls 5

DatasetClass · 0.90
assert_equalFunction · 0.90
isinMethod · 0.80
astypeMethod · 0.45
chunkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…