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

Method test_sel_drop_mindex

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

Source from the content-addressed store, hash-verified

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"))
1996 midx_coords = Coordinates.from_pandas_multiindex(midx, "x")
1997 data = Dataset(coords=midx_coords)
1998
1999 actual = data.sel(foo="a", drop=True)
2000 assert "foo" not in actual.coords
2001
2002 actual = data.sel(foo="a", drop=False)
2003 assert_equal(actual.foo, DataArray("a", coords={"foo": "a"}))
2004
2005 def test_isel_drop(self) -> None:
2006 data = Dataset({"foo": ("x", [1, 2, 3])}, {"x": [0, 1, 2]})

Callers

nothing calls this directly

Calls 5

selMethod · 0.95
DatasetClass · 0.90
assert_equalFunction · 0.90
DataArrayClass · 0.90

Tested by

no test coverage detected