(self)
| 467 | index.unstack() |
| 468 | |
| 469 | def test_create_variables(self) -> None: |
| 470 | foo_data = np.array([0, 0, 1], dtype="int64") |
| 471 | bar_data = np.array([1.1, 1.2, 1.3], dtype="float64") |
| 472 | pd_idx = pd.MultiIndex.from_arrays([foo_data, bar_data], names=("foo", "bar")) |
| 473 | index_vars = { |
| 474 | "x": IndexVariable("x", pd_idx), |
| 475 | "foo": IndexVariable("x", foo_data, attrs={"unit": "m"}), |
| 476 | "bar": IndexVariable("x", bar_data, encoding={"fill_value": 0}), |
| 477 | } |
| 478 | |
| 479 | index = PandasMultiIndex(pd_idx, "x") |
| 480 | actual = index.create_variables(index_vars) |
| 481 | |
| 482 | for k, expected in index_vars.items(): |
| 483 | assert_identical(actual[k], expected) |
| 484 | assert actual[k].dtype == expected.dtype |
| 485 | if k != "x": |
| 486 | assert actual[k].dtype == index.level_coords_dtype[k] |
| 487 | |
| 488 | def test_sel(self) -> None: |
| 489 | index = PandasMultiIndex( |
nothing calls this directly
no test coverage detected