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

ENH: match warning messages #37261

Closed
ivanovmg opened this issue Oct 19, 2020 · 0 comments · Fixed by #37263
Closed

ENH: match warning messages #37261

ivanovmg opened this issue Oct 19, 2020 · 0 comments · Fixed by #37263
Assignees
Labels
Enhancement Needs Triage Issue that has not been reviewed by a pandas team member Testing pandas testing functions or related to the test suite

Comments

@ivanovmg
Copy link
Member

Is your feature request related to a problem?

I wish we could match warning messages using pandas._testing.assert_produces_warning.
Currently it catches the warning category, but does not match the message.
Recently (#36982) I stumbled upon the need for this feature.

Describe the solution you'd like

pandas._testing.assert_produces_warning should take optional keyword argument match, to make it look similar to pytest.warns.

API breaking implications

Should not break existing API, as match would be an optional argument.

Describe alternatives you've considered

I used custom way of catching warnings (via warnings.catch_warnings) and matching their messages, but was suggested to give preference to assert_produces_warning.

@ivanovmg ivanovmg added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 19, 2020
@ivanovmg ivanovmg self-assigned this Oct 19, 2020
@ivanovmg ivanovmg added the Testing pandas testing functions or related to the test suite label Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Needs Triage Issue that has not been reviewed by a pandas team member Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant