(idx)
| 27 | |
| 28 | |
| 29 | def test_changing_names(idx): |
| 30 | assert [level.name for level in idx.levels] == ["first", "second"] |
| 31 | |
| 32 | view = idx.view() |
| 33 | copy = idx.copy() |
| 34 | shallow_copy = idx._view() |
| 35 | |
| 36 | # changing names should not change level names on object |
| 37 | new_names = [name + "a" for name in idx.names] |
| 38 | idx.names = new_names |
| 39 | check_level_names(idx, ["firsta", "seconda"]) |
| 40 | |
| 41 | # and not on copies |
| 42 | check_level_names(view, ["first", "second"]) |
| 43 | check_level_names(copy, ["first", "second"]) |
| 44 | check_level_names(shallow_copy, ["first", "second"]) |
| 45 | |
| 46 | # and copies shouldn't change original |
| 47 | shallow_copy.names = [name + "c" for name in shallow_copy.names] |
| 48 | check_level_names(idx, ["firsta", "seconda"]) |
| 49 | |
| 50 | |
| 51 | def test_take_preserve_name(idx): |
nothing calls this directly
no test coverage detected