/usr/local/lib64/python3.6/site-packages/pandas/tests/indexes/multi
NameSizeModeActions
__pycache__/-0755rm
conftest.py22160644editdlrm
test_analytics.py69840644editdlrm
test_astype.py9240644editdlrm
test_compat.py35340644editdlrm
test_constructors.py256460644editdlrm
test_conversion.py41890644editdlrm
test_copy.py23410644editdlrm
test_drop.py44280644editdlrm
test_duplicates.py101630644editdlrm
test_equivalence.py70830644editdlrm
test_formats.py77840644editdlrm
test_get_level_values.py35790644editdlrm
test_get_set.py117200644editdlrm
test_indexing.py299070644editdlrm
test_integrity.py84890644editdlrm
test_isin.py31740644editdlrm
test_join.py37880644editdlrm
test_lexsort.py13510644editdlrm
test_missing.py33780644editdlrm
test_monotonic.py69360644editdlrm
test_names.py45930644editdlrm
test_partial_indexing.py33760644editdlrm
test_reindex.py37450644editdlrm
test_reshape.py50410644editdlrm
test_setops.py121810644editdlrm
test_sorting.py84060644editdlrm
test_take.py25010644editdlrm
__init__.py00644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/pandas/tests/indexes/multi/test_copy.py (2341B)
from copy import copy, deepcopy import pytest from pandas import MultiIndex import pandas._testing as tm def assert_multiindex_copied(copy, original): # Levels should be (at least, shallow copied) tm.assert_copy(copy.levels, original.levels) tm.assert_almost_equal(copy.codes, original.codes) # Labels doesn't matter which way copied tm.assert_almost_equal(copy.codes, original.codes) assert copy.codes is not original.codes # Names doesn't matter which way copied assert copy.names == original.names assert copy.names is not original.names # Sort order should be copied assert copy.sortorder == original.sortorder def test_copy(idx): i_copy = idx.copy() assert_multiindex_copied(i_copy, idx) def test_shallow_copy(idx): i_copy = idx._shallow_copy() assert_multiindex_copied(i_copy, idx) def test_view(idx): i_view = idx.view() assert_multiindex_copied(i_view, idx) @pytest.mark.parametrize("func", [copy, deepcopy]) def test_copy_and_deepcopy(func): idx = MultiIndex( levels=[["foo", "bar"], ["fizz", "buzz"]], codes=[[0, 0, 0, 1], [0, 0, 1, 1]], names=["first", "second"], ) idx_copy = func(idx) assert idx_copy is not idx assert idx_copy.equals(idx) @pytest.mark.parametrize("deep", [True, False]) def test_copy_method(deep): idx = MultiIndex( levels=[["foo", "bar"], ["fizz", "buzz"]], codes=[[0, 0, 0, 1], [0, 0, 1, 1]], names=["first", "second"], ) idx_copy = idx.copy(deep=deep) assert idx_copy.equals(idx) @pytest.mark.parametrize("deep", [True, False]) @pytest.mark.parametrize( "kwarg, value", [ ("names", ["third", "fourth"]), ("levels", [["foo2", "bar2"], ["fizz2", "buzz2"]]), ("codes", [[1, 0, 0, 0], [1, 1, 0, 0]]), ], ) def test_copy_method_kwargs(deep, kwarg, value): # gh-12309: Check that the "name" argument as well other kwargs are honored idx = MultiIndex( levels=[["foo", "bar"], ["fizz", "buzz"]], codes=[[0, 0, 0, 1], [0, 0, 1, 1]], names=["first", "second"], ) idx_copy = idx.copy(**{kwarg: value, "deep": deep}) if kwarg == "names": assert getattr(idx_copy, kwarg) == value else: assert [list(i) for i in getattr(idx_copy, kwarg)] == value