Closed
Description
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:
- in
pandas/pandas/_testing/_warnings.py
Lines 19 to 27 in 8c7b0b2
expected_warning
so it can also beTuple[Type[Warning], ...]
- add a test to https://github.com/pandas-dev/pandas/blob/main/pandas/tests/util/test_assert_produces_warning.py for when matching multiple warnings