diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e4ea29aef2736..1e818e4ef2306 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -89,6 +89,9 @@ repos: # No direct imports from conftest conftest\ import| import\ conftest + + # Check for use of pandas.testing instead of tm + pd\.testing\. types: [python] files: ^pandas/tests/ - id: incorrect-code-directives diff --git a/pandas/tests/groupby/aggregate/test_aggregate.py b/pandas/tests/groupby/aggregate/test_aggregate.py index 073918eda3deb..324745fe0eab2 100644 --- a/pandas/tests/groupby/aggregate/test_aggregate.py +++ b/pandas/tests/groupby/aggregate/test_aggregate.py @@ -1049,7 +1049,7 @@ def test_groupby_get_by_index(): df = DataFrame({"A": ["S", "W", "W"], "B": [1.0, 1.0, 2.0]}) res = df.groupby("A").agg({"B": lambda x: x.get(x.index[-1])}) expected = DataFrame({"A": ["S", "W"], "B": [1.0, 2.0]}).set_index("A") - pd.testing.assert_frame_equal(res, expected) + tm.assert_frame_equal(res, expected) @pytest.mark.parametrize(