(self)
| 524 | assert actual.level_coords_dtype == level_coords_dtype |
| 525 | |
| 526 | def test_rename(self) -> None: |
| 527 | level_coords_dtype = {"one": "<U1", "two": np.int32} |
| 528 | index = PandasMultiIndex( |
| 529 | pd.MultiIndex.from_product([["a", "b"], [1, 2]], names=("one", "two")), |
| 530 | "x", |
| 531 | level_coords_dtype=level_coords_dtype, |
| 532 | ) |
| 533 | |
| 534 | # shortcut |
| 535 | new_index = index.rename({}, {}) |
| 536 | assert new_index is index |
| 537 | |
| 538 | new_index = index.rename({"two": "three"}, {}) |
| 539 | assert list(new_index.index.names) == ["one", "three"] |
| 540 | assert new_index.dim == "x" |
| 541 | assert new_index.level_coords_dtype == {"one": "<U1", "three": np.int32} |
| 542 | |
| 543 | new_index = index.rename({}, {"x": "y"}) |
| 544 | assert list(new_index.index.names) == ["one", "two"] |
| 545 | assert new_index.dim == "y" |
| 546 | assert new_index.level_coords_dtype == level_coords_dtype |
| 547 | |
| 548 | def test_copy(self) -> None: |
| 549 | level_coords_dtype = {"one": "U<1", "two": np.int32} |
nothing calls this directly
no test coverage detected