Skip to content

Commit ff66c6b

Browse files
committed
remove message
1 parent a55659c commit ff66c6b

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

pandas/tests/util/test_assert_produces_warning.py

-6
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,3 @@ def f(a=FutureWarning, b=RuntimeWarning):
1515
def test_assert_produces_warning_honors_filter():
1616
with tm.assert_produces_warning(RuntimeWarning):
1717
f()
18-
19-
20-
@pytest.mark.filterwarnings('ignore:f1:FutureWarning')
21-
def test_assert_produces_warning_message():
22-
with tm.assert_produces_warning(FutureWarning, message='f2'):
23-
f(FutureWarning, FutureWarning)

pandas/util/testing.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -2571,8 +2571,7 @@ def exception_matches(self, exc_type, exc_value, trace_back):
25712571

25722572
@contextmanager
25732573
def assert_produces_warning(expected_warning=Warning, filter_level="always",
2574-
clear=None, check_stacklevel=True,
2575-
message=''):
2574+
clear=None, check_stacklevel=True):
25762575
"""
25772576
Context manager for running code expected to either raise a specific
25782577
warning, or not raise any warnings. Verifies that the code raises the
@@ -2610,9 +2609,6 @@ class for all warnings. To check that no warning is returned,
26102609
If True, displays the line that called the function containing
26112610
the warning to show were the function is called. Otherwise, the
26122611
line that implements the function is displayed.
2613-
message : str, default ''
2614-
Use in the filter with `filter_level` and `expected_warning`
2615-
the control which warnings the filter applies to.
26162612
26172613
Examples
26182614
--------
@@ -2652,7 +2648,8 @@ class for all warnings. To check that no warning is returned,
26522648

26532649
saw_warning = False
26542650
if expected_warning and filter_level:
2655-
warnings.filterwarnings(filter_level, message, expected_warning)
2651+
warnings.filterwarnings(filter_level, message='',
2652+
category=expected_warning)
26562653
elif filter_level:
26572654
# no expected warnings.
26582655
warnings.simplefilter(filter_level)

0 commit comments

Comments
 (0)