Skip to content

TST: Fixed bare pytest.raises in test_window.py #32158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pandas/tests/window/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ def test_constructor(self, which):
c(win_type="boxcar", window=2, min_periods=1, center=False)

# not valid
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):
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="Invalid win_type"):
c(win_type=wt, window=2)

@td.skip_if_no_scipy
Expand Down