@@ -547,7 +547,7 @@ def test_axis1_numeric_only(request, groupby_func, numeric_only):
547
547
kwargs ["numeric_only" ] = numeric_only
548
548
549
549
# Functions without numeric_only and axis args
550
- no_args = ("cumprod" , "cumsum" , " diff" , "fillna" , "pct_change" , "rank" , "shift" )
550
+ no_args = ("diff" , "fillna" , "pct_change" , "rank" , "shift" )
551
551
# Functions with axis args
552
552
has_axis = (
553
553
"cumprod" ,
@@ -565,13 +565,8 @@ def test_axis1_numeric_only(request, groupby_func, numeric_only):
565
565
warn_msg = f"DataFrameGroupBy.{ groupby_func } with axis=1 is deprecated"
566
566
if numeric_only is not None and groupby_func in no_args :
567
567
msg = "got an unexpected keyword argument 'numeric_only'"
568
- if groupby_func in ["cumprod" , "cumsum" ]:
569
- with pytest .raises (TypeError , match = msg ):
570
- with tm .assert_produces_warning (FutureWarning , match = warn_msg ):
571
- method (* args , ** kwargs )
572
- else :
573
- with pytest .raises (TypeError , match = msg ):
574
- method (* args , ** kwargs )
568
+ with pytest .raises (TypeError , match = msg ):
569
+ method (* args , ** kwargs )
575
570
elif groupby_func not in has_axis :
576
571
msg = "got an unexpected keyword argument 'axis'"
577
572
with pytest .raises (TypeError , match = msg ):
@@ -814,11 +809,13 @@ def test_numpy_compat(func):
814
809
g = df .groupby ("A" )
815
810
816
811
msg = "numpy operations are not valid with groupby"
812
+ warn_msg = f"DataFrameGroupBy.{ func } with axis=1 is deprecated"
817
813
818
- with pytest .raises (UnsupportedFunctionCall , match = msg ):
819
- getattr (g , func )(1 , 2 , 3 )
820
- with pytest .raises (UnsupportedFunctionCall , match = msg ):
821
- getattr (g , func )(foo = 1 )
814
+ with pytest .raises (FutureWarning , match = warn_msg ):
815
+ with pytest .raises (UnsupportedFunctionCall , match = msg ):
816
+ getattr (g , func )(1 , 2 , 3 )
817
+ with pytest .raises (UnsupportedFunctionCall , match = msg ):
818
+ getattr (g , func )(foo = 1 )
822
819
823
820
824
821
def test_cummin (dtypes_for_minmax ):
0 commit comments