| 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 |