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)