Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c296ab

Browse files
authored
Update test_plot_confusion_matrix.py
1 parent 172e5c2 commit 0c296ab

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sklearn/metrics/_plot/tests/test_plot_confusion_matrix.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,17 @@ def test_confusion_matrix_pipeline(pyplot, clf, data, n_classes):
249249
assert disp.text_.shape == (n_classes, n_classes)
250250

251251

252+
@pytest.mark.parametrize("colorbar", [True, False])
253+
def test_plot_confusion_matrix_colorbar(pyplot, data, fitted_clf, colorbar):
254+
X, y = data
255+
disp = plot_confusion_matrix(fitted_clf, X, y, colorbar=True)
256+
assert disp.im_.colorbar is not None
257+
258+
# attempt a plot with the opposit effect
259+
disp.plot(colorbar=False)
260+
assert disp.im_.colorbar is None
261+
262+
252263
@pytest.mark.parametrize("values_format", ['e', 'n'])
253264
def test_confusion_matrix_text_format(pyplot, data, y_pred, n_classes,
254265
fitted_clf, values_format):

0 commit comments

Comments
 (0)