@@ -2571,8 +2571,7 @@ def exception_matches(self, exc_type, exc_value, trace_back):
2571
2571
2572
2572
@contextmanager
2573
2573
def assert_produces_warning (expected_warning = Warning , filter_level = "always" ,
2574
- clear = None , check_stacklevel = True ,
2575
- message = '' ):
2574
+ clear = None , check_stacklevel = True ):
2576
2575
"""
2577
2576
Context manager for running code expected to either raise a specific
2578
2577
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,
2610
2609
If True, displays the line that called the function containing
2611
2610
the warning to show were the function is called. Otherwise, the
2612
2611
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.
2616
2612
2617
2613
Examples
2618
2614
--------
@@ -2652,7 +2648,8 @@ class for all warnings. To check that no warning is returned,
2652
2648
2653
2649
saw_warning = False
2654
2650
if expected_warning and filter_level :
2655
- warnings .filterwarnings (filter_level , message , expected_warning )
2651
+ warnings .filterwarnings (filter_level , message = '' ,
2652
+ category = expected_warning )
2656
2653
elif filter_level :
2657
2654
# no expected warnings.
2658
2655
warnings .simplefilter (filter_level )
0 commit comments