ENH: match warning messages #37261
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
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 argumentmatch
, to make it look similar topytest.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 toassert_produces_warning
.The text was updated successfully, but these errors were encountered: