From 8816d5d45926cd0a298e76480749734d8c5fb7c5 Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 30 Jan 2023 23:08:08 -0500 Subject: [PATCH] TST: Move xfail to its own test --- pandas/tests/groupby/test_groupby.py | 8 -------- pandas/tests/groupby/test_raises.py | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pandas/tests/groupby/test_groupby.py b/pandas/tests/groupby/test_groupby.py index e9b18836e003c..1a145c65a13a9 100644 --- a/pandas/tests/groupby/test_groupby.py +++ b/pandas/tests/groupby/test_groupby.py @@ -2426,14 +2426,6 @@ def test_group_on_two_row_multiindex_returns_one_tuple_key(): (DataFrame, "group_keys", False), (DataFrame, "observed", True), (DataFrame, "dropna", False), - pytest.param( - Series, - "axis", - 1, - marks=pytest.mark.xfail( - reason="GH 35443: Attribute currently not passed on to series" - ), - ), (Series, "level", "a"), (Series, "as_index", False), (Series, "sort", False), diff --git a/pandas/tests/groupby/test_raises.py b/pandas/tests/groupby/test_raises.py index cc3f468349efb..1c889e6ed457a 100644 --- a/pandas/tests/groupby/test_raises.py +++ b/pandas/tests/groupby/test_raises.py @@ -176,3 +176,11 @@ def func(x): with pytest.raises(TypeError, match="Test error message"): getattr(gb, how)(func) + + +def test_subsetting_columns_axis_1_raises(): + # GH 35443 + df = DataFrame({"a": [1], "b": [2], "c": [3]}) + gb = df.groupby("a", axis=1) + with pytest.raises(ValueError, match="Cannot subset columns when using axis=1"): + gb["b"]