(self)
| 5055 | data.assign_coords(level_1=range(4)) |
| 5056 | |
| 5057 | def test_assign_new_multiindex(self) -> None: |
| 5058 | midx = pd.MultiIndex.from_arrays([["a", "a", "b", "b"], [0, 1, 0, 1]]) |
| 5059 | midx_coords = Coordinates.from_pandas_multiindex(midx, "x") |
| 5060 | |
| 5061 | ds = Dataset(coords={"x": [1, 2]}) |
| 5062 | expected = Dataset(coords=midx_coords) |
| 5063 | |
| 5064 | with pytest.warns( |
| 5065 | FutureWarning, |
| 5066 | match=r".*`pandas.MultiIndex`.*no longer be implicitly promoted.*", |
| 5067 | ): |
| 5068 | actual = ds.assign(x=midx) |
| 5069 | assert_identical(actual, expected) |
| 5070 | |
| 5071 | @pytest.mark.parametrize("orig_coords", [{}, {"x": range(4)}]) |
| 5072 | def test_assign_coords_new_multiindex(self, orig_coords) -> None: |
nothing calls this directly
no test coverage detected