class_docstr: Test the PredictionError visualizer
class_docstr_tok: ["Test","the","PredictionError","visualizer"]
docstr: Test that PredictionError properly handles an already-fitted model
docstr_tok: ["Test","that","PredictionError","properly","handles","an","already-fitted","model"]
code: def test_peplot_with_fitted(self):
      """
      Test that PredictionError properly handles an already-fitted model
      """
      X, y = load_energy(return_dataset=True).to_numpy()
  
      model = Ridge().fit(X, y)
  
      with mock.patch.object(model, "fit") as mockfit:
          oz = PredictionError(model)
          oz.fit(X, y)
          mockfit.assert_not_called()
  
      with mock.patch.object(model, "fit") as mockfit:
          oz = PredictionError(model, is_fitted=True)
          oz.fit(X, y)
          mockfit.assert_not_called()
  
      with mock.patch.object(model, "fit") as mockfit:
          oz = PredictionError(model, is_fitted=False)
          oz.fit(X, y)
          mockfit.assert_called_once_with(X, y)
  
imports: import pytest
  import matplotlib.pyplot
  import numpy
  from unittest import mock
  from tests.fixtures import Dataset, Split
  from tests.base import IS_WINDOWS_OR_CONDA, VisualTestCase
  from yellowbrick.datasets import load_energy, load_concrete
  from yellowbrick.regressor.prediction_error import PredictionError, prediction_error
  from sklearn.datasets import make_regression
  from sklearn.linear_model import Ridge, Lasso
  from sklearn.neural_network import MLPRegressor
  from sklearn.linear_model import LinearRegression
  from sklearn.model_selection import train_test_split
  from sklearn.pipeline import Pipeline
  from sklearn.impute import SimpleImputer
label_desc: Use image node_id 10 for calling the TestPredictionError obj's underlying member method code with example usage: obj.test_peplot_with_fitted() without return types