From 6b456f6e0b3264ff92bbc35bd3e68ae182389339 Mon Sep 17 00:00:00 2001 From: moink Date: Wed, 30 Dec 2020 14:47:30 +0100 Subject: [PATCH] TST: GH30999 add msg to pytest.raises in pandas/tests/window/moments (#38804) --- pandas/tests/window/moments/test_moments_ewm.py | 7 ++++--- pandas/tests/window/test_apply.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pandas/tests/window/moments/test_moments_ewm.py b/pandas/tests/window/moments/test_moments_ewm.py index eceba7f143ab9..70706c027a21e 100644 --- a/pandas/tests/window/moments/test_moments_ewm.py +++ b/pandas/tests/window/moments/test_moments_ewm.py @@ -218,11 +218,12 @@ def test_ewma_halflife_arg(series): msg = "comass, span, halflife, and alpha are mutually exclusive" with pytest.raises(ValueError, match=msg): series.ewm(span=20, halflife=50) - with pytest.raises(ValueError): + with pytest.raises(ValueError, match=msg): series.ewm(com=9.5, halflife=50) - with pytest.raises(ValueError): + with pytest.raises(ValueError, match=msg): series.ewm(com=9.5, span=20, halflife=50) - with pytest.raises(ValueError): + msg = "Must pass one of comass, span, halflife, or alpha" + with pytest.raises(ValueError, match=msg): series.ewm() diff --git a/pandas/tests/window/test_apply.py b/pandas/tests/window/test_apply.py index 076578f4dc3c4..b47cd71beb6a8 100644 --- a/pandas/tests/window/test_apply.py +++ b/pandas/tests/window/test_apply.py @@ -44,7 +44,7 @@ def f(x): expected = df.iloc[2:].reindex_like(df) tm.assert_frame_equal(result, expected) - with pytest.raises(AttributeError): + with tm.external_error_raised(AttributeError): df.rolling(window).apply(f, raw=True)