From 0a2506a8c0e63492c05374d2fce0c289a586656d Mon Sep 17 00:00:00 2001 From: Chang Luo <33987852+luochang212@users.noreply.github.com> Date: Sat, 25 May 2024 01:41:59 +0800 Subject: [PATCH] update test_plot.py --- tests/test_plot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_plot.py b/tests/test_plot.py index 66627b0..07d64da 100644 --- a/tests/test_plot.py +++ b/tests/test_plot.py @@ -1,13 +1,17 @@ +from unittest import mock + from flameai.plot import confusion_matrix, roc_curve def test_roc_curve() -> None: y_true = [0, 1, 1, 0, 1, 1, 0, 0, 1, 1] y_score = [0.1, 0.4, 0.35, 0.8, 0.15, 0.35, 0.2, 0.7, 0.05, 0.9] - roc_curve(y_true, y_score) + with mock.patch('matplotlib.pyplot.show'): + roc_curve(y_true, y_score) def test_confusion_matrix() -> None: y_true = [0, 1, 1, 0, 1, 1, 0, 0, 0, 1] y_label = [1, 1, 1, 0, 1, 0, 0, 0, 1, 1] - confusion_matrix(y_true, y_label) + with mock.patch('matplotlib.pyplot.show'): + confusion_matrix(y_true, y_label)