Skip to content

Commit

Permalink
fix random change
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelFu512 committed May 22, 2024
1 parent 9a5ca28 commit 35bdb05
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from itertools import product
from unittest.mock import patch

Expand Down Expand Up @@ -79,7 +80,7 @@ def test_force_plot_binary(
else:
# Code chunk to test where initjs is called if jupyter is recognized
jupyter_check.return_value = False
with pytest.warns(None) as graph_valid:
with warnings.catch_warnings(record=True) as graph_valid:
results = graph_force_plot(
pipeline,
rows_to_explain=rows_to_explain,
Expand All @@ -88,11 +89,11 @@ def test_force_plot_binary(
matplotlib=False,
)
assert not initjs.called
warnings = set([str(gv) for gv in graph_valid])
assert all(["DeprecationWarning" in w for w in warnings])
warnings_deprecated = set([str(gv) for gv in graph_valid])
assert all(["DeprecationWarning" in w for w in warnings_deprecated])

jupyter_check.return_value = True
with pytest.warns(None) as graph_valid:
with warnings.catch_warnings(record=True) as graph_valid:
results = graph_force_plot(
pipeline,
rows_to_explain=rows_to_explain,
Expand All @@ -101,8 +102,8 @@ def test_force_plot_binary(
matplotlib=False,
)
assert initjs.called
warnings = set([str(gv) for gv in graph_valid])
assert all(["DeprecationWarning" in w for w in warnings])
warnings_deprecated = set([str(gv) for gv in graph_valid])
assert all(["DeprecationWarning" in w for w in warnings_deprecated])

# Should have a result per row to explain.
assert len(results) == len(rows_to_explain)
Expand Down

0 comments on commit 35bdb05

Please sign in to comment.