From 08bf3d2385cd93528a535356f54132219bc00217 Mon Sep 17 00:00:00 2001 From: Mabroor Ahmed Date: Fri, 21 Feb 2020 16:50:15 +0000 Subject: [PATCH 1/2] Fixed bare pytest.raises in test_window --- pandas/tests/window/test_window.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pandas/tests/window/test_window.py b/pandas/tests/window/test_window.py index cc29ab4f2cd62..6361e7639ba78 100644 --- a/pandas/tests/window/test_window.py +++ b/pandas/tests/window/test_window.py @@ -29,14 +29,19 @@ def test_constructor(self, which): c(win_type="boxcar", window=2, min_periods=1, center=False) # not valid + msg = ( + "min_periods must be an integer|" + "center must be a boolean|" + "Invalid win_type" + ) for w in [2.0, "foo", np.array([2])]: - with pytest.raises(ValueError): + with pytest.raises(ValueError, match=msg): c(win_type="boxcar", window=2, min_periods=w) - with pytest.raises(ValueError): + with pytest.raises(ValueError, match=msg): c(win_type="boxcar", window=2, min_periods=1, center=w) for wt in ["foobar", 1]: - with pytest.raises(ValueError): + with pytest.raises(ValueError, match=msg): c(win_type=wt, window=2) @td.skip_if_no_scipy From 35da56bda22cbd3343eae461f709d0d251887c5d Mon Sep 17 00:00:00 2001 From: Mabroor Ahmed Date: Sun, 23 Feb 2020 08:51:01 +0000 Subject: [PATCH 2/2] TST: Fixed bare pytest.raises for test_window --- pandas/tests/window/test_window.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pandas/tests/window/test_window.py b/pandas/tests/window/test_window.py index 6361e7639ba78..41b9d9e84f27e 100644 --- a/pandas/tests/window/test_window.py +++ b/pandas/tests/window/test_window.py @@ -29,11 +29,7 @@ def test_constructor(self, which): c(win_type="boxcar", window=2, min_periods=1, center=False) # not valid - msg = ( - "min_periods must be an integer|" - "center must be a boolean|" - "Invalid win_type" - ) + msg = "|".join(["min_periods must be an integer", "center must be a boolean"]) for w in [2.0, "foo", np.array([2])]: with pytest.raises(ValueError, match=msg): c(win_type="boxcar", window=2, min_periods=w) @@ -41,7 +37,7 @@ def test_constructor(self, which): c(win_type="boxcar", window=2, min_periods=1, center=w) for wt in ["foobar", 1]: - with pytest.raises(ValueError, match=msg): + with pytest.raises(ValueError, match="Invalid win_type"): c(win_type=wt, window=2) @td.skip_if_no_scipy