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

Method test_stack_create_index

xarray/tests/test_dataset.py:4135–4145  ·  view source on GitHub ↗
(self, create_index, expected_keys)

Source from the content-addressed store, hash-verified

4133 ],
4134 )
4135 def test_stack_create_index(self, create_index, expected_keys) -> None:
4136 ds = Dataset(
4137 data_vars={"b": (("x", "y"), [[0, 1], [2, 3]])},
4138 coords={"x": ("x", [0, 1]), "y": ["a", "b"]},
4139 )
4140
4141 actual = ds.stack(z=["x", "y"], create_index=create_index)
4142 assert list(actual.xindexes) == expected_keys
4143
4144 # TODO: benbovy (flexible indexes) - test error multiple indexes found
4145 # along dimension + create_index=True
4146
4147 def test_stack_multi_index(self) -> None:
4148 # multi-index on a dimension to stack is discarded too

Callers

nothing calls this directly

Calls 2

stackMethod · 0.95
DatasetClass · 0.90

Tested by

no test coverage detected