class_docstr: Test ClassPredictionError visualizer
class_docstr_tok: ["Test","ClassPredictionError","visualizer"]
docstr: Test that visualizer properly handles an already-fitted model
docstr_tok: ["Test","that","visualizer","properly","handles","an","already-fitted","model"]
code: def test_with_fitted(self):
      """
      Test that visualizer properly handles an already-fitted model
      """
      X, y = load_occupancy(return_dataset=True).to_numpy()
  
      model = RandomForestClassifier().fit(X, y)
      classes = ["unoccupied", "occupied"]
  
      with patch.object(model, "fit") as mockfit:
          oz = ClassPredictionError(model, classes=classes)
          oz.fit(X, y)
          mockfit.assert_not_called()
  
      with patch.object(model, "fit") as mockfit:
          oz = ClassPredictionError(
              model, classes=classes, is_fitted=True
          )
          oz.fit(X, y)
          mockfit.assert_not_called()
  
      with patch.object(model, "fit") as mockfit:
          oz = ClassPredictionError(
              model, classes=classes, is_fitted=False
          )
          oz.fit(X, y)
          mockfit.assert_called_once_with(X, y)
  
imports: import pytest
  import matplotlib.pyplot
  from yellowbrick.exceptions import ModelError
  from yellowbrick.datasets import load_occupancy
  from yellowbrick.classifier.class_prediction_error import *
  from sklearn.svm import LinearSVC, SVC
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.datasets import make_multilabel_classification
  from sklearn.model_selection import train_test_split
  from sklearn.pipeline import Pipeline
  from sklearn.preprocessing import MinMaxScaler
  from unittest.mock import patch
  from tests.base import VisualTestCase
label_desc: Use image node_id 11 for calling the TestClassPredictionError obj's underlying member method code with example usage: obj.test_with_fitted() without return types