From 6e2063b21b8f130aac71a6cf01d1c0e23d9d39d4 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Mon, 24 Oct 2022 23:53:04 +0200 Subject: [PATCH 1/2] CI: Catch FutureWarnings --- pandas/tests/frame/test_reductions.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandas/tests/frame/test_reductions.py b/pandas/tests/frame/test_reductions.py index 744d06d6cf339..94ee8f4ead0c8 100644 --- a/pandas/tests/frame/test_reductions.py +++ b/pandas/tests/frame/test_reductions.py @@ -168,7 +168,14 @@ class TestDataFrameAnalytics: ], ) def test_stat_op_api_float_string_frame(self, float_string_frame, axis, opname): - getattr(float_string_frame, opname)(axis=axis) + if opname in ["sum", "min", "max"] and axis == 0: + warn = None + elif opname not in ["count", "nunique"]: + warn = FutureWarning + else: + warn = None + with tm.assert_produces_warning(warn): + getattr(float_string_frame, opname)(axis=axis) if opname != "nunique": getattr(float_string_frame, opname)(axis=axis, numeric_only=True) From 64d64d2f02befad614d49f672f867ef91c8970c6 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Tue, 25 Oct 2022 00:07:50 +0200 Subject: [PATCH 2/2] Add match --- pandas/tests/frame/test_reductions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/frame/test_reductions.py b/pandas/tests/frame/test_reductions.py index 94ee8f4ead0c8..963ed24cb434b 100644 --- a/pandas/tests/frame/test_reductions.py +++ b/pandas/tests/frame/test_reductions.py @@ -174,7 +174,8 @@ def test_stat_op_api_float_string_frame(self, float_string_frame, axis, opname): warn = FutureWarning else: warn = None - with tm.assert_produces_warning(warn): + msg = "nuisance columns|default value of numeric_only" + with tm.assert_produces_warning(warn, match=msg): getattr(float_string_frame, opname)(axis=axis) if opname != "nunique": getattr(float_string_frame, opname)(axis=axis, numeric_only=True)