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

Method test_get_index

xarray/tests/test_dataarray.py:193–198  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

191 assert array.indexes[k].equals(expected_indexes[k])
192
193 def test_get_index(self) -> None:
194 array = DataArray(np.zeros((2, 3)), coords={"x": ["a", "b"]}, dims=["x", "y"])
195 assert array.get_index("x").equals(pd.Index(["a", "b"]))
196 assert array.get_index("y").equals(pd.Index([0, 1, 2]))
197 with pytest.raises(KeyError):
198 array.get_index("z")
199
200 def test_get_index_size_zero(self) -> None:
201 array = DataArray(np.zeros((0,)), dims=["x"])

Callers

nothing calls this directly

Calls 3

DataArrayClass · 0.90
get_indexMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected