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

Method test_constructor

xarray/tests/test_indexes.py:118–130  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

116
117class TestPandasIndex:
118 def test_constructor(self) -> None:
119 pd_idx = pd.Index([1, 2, 3])
120 index = PandasIndex(pd_idx, "x")
121
122 assert index.index.equals(pd_idx)
123 # makes a shallow copy
124 assert index.index is not pd_idx
125 assert index.dim == "x"
126
127 # test no name set for pd.Index
128 pd_idx.name = None
129 index = PandasIndex(pd_idx, "x")
130 assert index.index.name == "x"
131
132 def test_from_variables(self) -> None:
133 # pandas has only Float64Index but variable dtype should be preserved

Callers

nothing calls this directly

Calls 2

PandasIndexClass · 0.90
equalsMethod · 0.45

Tested by

no test coverage detected