Skip to content
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

TST: GH30999 add match=msg to all pytest.raises in pandas/tests/window #38804

Merged

Conversation

moink
Copy link
Member

@moink moink commented Dec 30, 2020

This pull request partially addresses xref #30999 to remove bare pytest.raises by adding match=msg. It doesn't close that issue as I have only addressed test modules in the pandas/tests/window/ directory.

I have added match=msg to 3 instances of pytest.raises and converted another to a tm.external_error_raised. Nothing complicated or controversial, imo.

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@jreback jreback added Error Reporting Incorrect or improved errors from pandas Code Style Code style, linting, code_checks labels Dec 30, 2020
@jreback jreback added this to the 1.3 milestone Dec 30, 2020
@@ -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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this error?

Copy link
Member Author

@moink moink Dec 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AttributeError: 'numpy.ndarray' object has no attribute 'index' in both cases

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose from a numpy array not having an index attribute

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm. i think we could raise a better message here as to what the issue is (trying to use pandas functions inside the rolling when raw=True). cc @mroeschke let me create an issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jreback
Copy link
Contributor

jreback commented Dec 30, 2020

thanks @moink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants