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

Method test_sel_drop

xarray/tests/test_dataset.py:1979–1992  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1977 assert actual["values"].shape == (1, 2)
1978
1979 def test_sel_drop(self) -> None:
1980 data = Dataset({"foo": ("x", [1, 2, 3])}, {"x": [0, 1, 2]})
1981 expected = Dataset({"foo": 1})
1982 selected = data.sel(x=0, drop=True)
1983 assert_identical(expected, selected)
1984
1985 expected = Dataset({"foo": 1}, {"x": 0})
1986 selected = data.sel(x=0, drop=False)
1987 assert_identical(expected, selected)
1988
1989 data = Dataset({"foo": ("x", [1, 2, 3])})
1990 expected = Dataset({"foo": 1})
1991 selected = data.sel(x=0, drop=True)
1992 assert_identical(expected, selected)
1993
1994 def test_sel_drop_mindex(self) -> None:
1995 midx = pd.MultiIndex.from_arrays([["a", "a"], [1, 2]], names=("foo", "bar"))

Callers

nothing calls this directly

Calls 3

selMethod · 0.95
DatasetClass · 0.90
assert_identicalFunction · 0.90

Tested by

no test coverage detected