/usr/local/lib64/python3.6/site-packages/pandas/tests/util
NameSizeModeActions
__pycache__/-0755rm
conftest.py4760644editdlrm
test_assert_almost_equal.py114990644editdlrm
test_assert_categorical_equal.py27490644editdlrm
test_assert_extension_array_equal.py34710644editdlrm
test_assert_frame_equal.py88350644editdlrm
test_assert_index_equal.py56640644editdlrm
test_assert_interval_array_equal.py23640644editdlrm
test_assert_numpy_array_equal.py63610644editdlrm
test_assert_produces_warning.py5470644editdlrm
test_assert_series_equal.py90890644editdlrm
test_deprecate.py16260644editdlrm
test_deprecate_kwarg.py20430644editdlrm
test_deprecate_nonkeyword_arguments.py27130644editdlrm
test_doc.py14920644editdlrm
test_hashing.py108600644editdlrm
test_numba.py3080644editdlrm
test_safe_import.py10200644editdlrm
test_show_versions.py11870644editdlrm
test_util.py19820644editdlrm
test_validate_args.py18440644editdlrm
test_validate_args_and_kwargs.py23910644editdlrm
test_validate_kwargs.py17400644editdlrm
__init__.py00644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/pandas/tests/util/test_assert_categorical_equal.py (2749B)
import pytest from pandas import Categorical import pandas._testing as tm @pytest.mark.parametrize( "c", [Categorical([1, 2, 3, 4]), Categorical([1, 2, 3, 4], categories=[1, 2, 3, 4, 5])], ) def test_categorical_equal(c): tm.assert_categorical_equal(c, c) @pytest.mark.parametrize("check_category_order", [True, False]) def test_categorical_equal_order_mismatch(check_category_order): c1 = Categorical([1, 2, 3, 4], categories=[1, 2, 3, 4]) c2 = Categorical([1, 2, 3, 4], categories=[4, 3, 2, 1]) kwargs = dict(check_category_order=check_category_order) if check_category_order: msg = """Categorical\\.categories are different Categorical\\.categories values are different \\(100\\.0 %\\) \\[left\\]: Int64Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\) \\[right\\]: Int64Index\\(\\[4, 3, 2, 1\\], dtype='int64'\\)""" with pytest.raises(AssertionError, match=msg): tm.assert_categorical_equal(c1, c2, **kwargs) else: tm.assert_categorical_equal(c1, c2, **kwargs) def test_categorical_equal_categories_mismatch(): msg = """Categorical\\.categories are different Categorical\\.categories values are different \\(25\\.0 %\\) \\[left\\]: Int64Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\) \\[right\\]: Int64Index\\(\\[1, 2, 3, 5\\], dtype='int64'\\)""" c1 = Categorical([1, 2, 3, 4]) c2 = Categorical([1, 2, 3, 5]) with pytest.raises(AssertionError, match=msg): tm.assert_categorical_equal(c1, c2) def test_categorical_equal_codes_mismatch(): categories = [1, 2, 3, 4] msg = """Categorical\\.codes are different Categorical\\.codes values are different \\(50\\.0 %\\) \\[left\\]: \\[0, 1, 3, 2\\] \\[right\\]: \\[0, 1, 2, 3\\]""" c1 = Categorical([1, 2, 4, 3], categories=categories) c2 = Categorical([1, 2, 3, 4], categories=categories) with pytest.raises(AssertionError, match=msg): tm.assert_categorical_equal(c1, c2) def test_categorical_equal_ordered_mismatch(): data = [1, 2, 3, 4] msg = """Categorical are different Attribute "ordered" are different \\[left\\]: False \\[right\\]: True""" c1 = Categorical(data, ordered=False) c2 = Categorical(data, ordered=True) with pytest.raises(AssertionError, match=msg): tm.assert_categorical_equal(c1, c2) @pytest.mark.parametrize("obj", ["index", "foo", "pandas"]) def test_categorical_equal_object_override(obj): data = [1, 2, 3, 4] msg = f"""{obj} are different Attribute "ordered" are different \\[left\\]: False \\[right\\]: True""" c1 = Categorical(data, ordered=False) c2 = Categorical(data, ordered=True) with pytest.raises(AssertionError, match=msg): tm.assert_categorical_equal(c1, c2, obj=obj)