Skip to content

DOC: clarify that assert_produces_warning can take multiple warnings #47829

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

Closed
MarcoGorelli opened this issue Jul 23, 2022 · 2 comments · Fixed by #47833
Closed

DOC: clarify that assert_produces_warning can take multiple warnings #47829

MarcoGorelli opened this issue Jul 23, 2022 · 2 comments · Fixed by #47833
Labels
good first issue Testing pandas testing functions or related to the test suite Warnings Warnings that appear or should be added to pandas

Comments

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Jul 23, 2022

Noticed in #47828 (comment)

Currently, it's possible to match multiple warnings, by passing them as a tuple. But, this isn't documented, nor do the types suggest it:

Example:

import warnings
import pytest
import pandas._testing as tm

def me():
    warnings.warn('foo', FutureWarning)
    warnings.warn('bar', UserWarning)

def test_1():
    with tm.assert_produces_warning((FutureWarning, UserWarning), match=r'foo|bar'):
        me()

So, the issue would be:

@MarcoGorelli MarcoGorelli added the Testing pandas testing functions or related to the test suite label Jul 23, 2022
@MarcoGorelli MarcoGorelli changed the title TST: let assert_produces_warning take multiple warnings TST: clarify that assert_produces_warning take multiple warnings Jul 23, 2022
@MarcoGorelli MarcoGorelli changed the title TST: clarify that assert_produces_warning take multiple warnings TST: clarify that assert_produces_warning can take multiple warnings Jul 23, 2022
@MarcoGorelli MarcoGorelli added Warnings Warnings that appear or should be added to pandas good first issue labels Jul 23, 2022
@MarcoGorelli MarcoGorelli changed the title TST: clarify that assert_produces_warning can take multiple warnings DOC: clarify that assert_produces_warning can take multiple warnings Jul 23, 2022
@Femme-js
Copy link

Hi, I want to take this forward. Can you help me proceed with it?

@MarcoGorelli
Copy link
Member Author

hey @Femme-js - here's the contributing guide

what do you need help with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Testing pandas testing functions or related to the test suite Warnings Warnings that appear or should be added to pandas
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants