1
- import warnings
2
1
from itertools import product
3
2
from unittest .mock import patch
4
3
@@ -80,7 +79,7 @@ def test_force_plot_binary(
80
79
else :
81
80
# Code chunk to test where initjs is called if jupyter is recognized
82
81
jupyter_check .return_value = False
83
- with warnings . catch_warnings ( record = True ) as graph_valid :
82
+ with pytest . warns ( None ) as graph_valid :
84
83
results = graph_force_plot (
85
84
pipeline ,
86
85
rows_to_explain = rows_to_explain ,
@@ -89,11 +88,11 @@ def test_force_plot_binary(
89
88
matplotlib = False ,
90
89
)
91
90
assert not initjs .called
92
- warnings_deprecated = set ([str (gv ) for gv in graph_valid . list ])
93
- assert all (["DeprecationWarning" in w for w in warnings_deprecated ])
91
+ warnings = set ([str (gv ) for gv in graph_valid ])
92
+ assert all (["DeprecationWarning" in w for w in warnings ])
94
93
95
94
jupyter_check .return_value = True
96
- with warnings . catch_warnings ( record = True ) as graph_valid :
95
+ with pytest . warns ( None ) as graph_valid :
97
96
results = graph_force_plot (
98
97
pipeline ,
99
98
rows_to_explain = rows_to_explain ,
@@ -102,8 +101,8 @@ def test_force_plot_binary(
102
101
matplotlib = False ,
103
102
)
104
103
assert initjs .called
105
- warnings_deprecated = set ([str (gv ) for gv in graph_valid . list ])
106
- assert all (["DeprecationWarning" in w for w in warnings_deprecated ])
104
+ warnings = set ([str (gv ) for gv in graph_valid ])
105
+ assert all (["DeprecationWarning" in w for w in warnings ])
107
106
108
107
# Should have a result per row to explain.
109
108
assert len (results ) == len (rows_to_explain )
0 commit comments