Skip to content

Conversation

ivanovmg
Copy link
Contributor

Implement matching warning message.
New kwarg match in assert_produces_warning.

filter_level="always",
check_stacklevel=True,
raise_on_extra_warnings=True,
match=None,
Copy link
Member

Choose a reason for hiding this comment

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

can you annoate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Annotated, but presumably the code became slightly less pythonic. Sorry for that.

],
)
def category(request):
"""Return unique warning.
Copy link
Member

Choose a reason for hiding this comment

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

newline after """

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

comment, but ok to merge after @jbrockmendel doc-string comments.

)


def _assert_raised_with_correct_stacklevel(actual_warning):
Copy link
Contributor

Choose a reason for hiding this comment

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

bonus points for typing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Annotated. IMHO, the type warnings.WarningMessage, although correct, has a confusing name for warning instance.

@jreback jreback added the Testing pandas testing functions or related to the test suite label Oct 20, 2020
@jreback jreback added this to the 1.2 milestone Oct 20, 2020
@ivanovmg ivanovmg requested a review from jreback October 20, 2020 02:50
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

@@ -0,0 +1,138 @@
""""
Test module for testing ``pandas._testing.assert_produces_warning``.
"""
Copy link
Member

Choose a reason for hiding this comment

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

There is already a file with tests for this, in tests/util/test_assert_produces_warning.py, can you move this there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I completely missed it. I moved tests as requested.

@jreback jreback merged commit 77811c7 into pandas-dev:master Oct 20, 2020
@jreback
Copy link
Contributor

jreback commented Oct 20, 2020

thanks @ivanovmg very nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Testing pandas testing functions or related to the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: match warning messages

4 participants