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

Method test_from_xindex

xarray/tests/test_coordinates.py:78–87  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

76 Coordinates(coords={"foo": ("x", [1, 2]), "bar": ("x", [1, 2, 3, 4])})
77
78 def test_from_xindex(self) -> None:
79 idx = PandasIndex([1, 2, 3], "x")
80 coords = Coordinates.from_xindex(idx)
81
82 assert isinstance(coords.xindexes["x"], PandasIndex)
83 assert coords.xindexes["x"].equals(idx)
84
85 expected = PandasIndex(idx, "x").create_variables()
86 assert list(coords.variables) == list(expected)
87 assert_identical(expected["x"], coords.variables["x"])
88
89 def test_from_xindex_error(self) -> None:
90 class CustomIndexNoCoordsGenerated(Index):

Callers

nothing calls this directly

Calls 5

PandasIndexClass · 0.90
assert_identicalFunction · 0.90
from_xindexMethod · 0.80
equalsMethod · 0.45
create_variablesMethod · 0.45

Tested by

no test coverage detected