Skip to content

ENH: match warning messages #37261

Closed
@ivanovmg

Description

@ivanovmg

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.

Metadata

Metadata

Assignees

Labels

EnhancementNeeds TriageIssue that has not been reviewed by a pandas team memberTestingpandas testing functions or related to the test suite

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions