code: def test_from_estimator_not_fitted(pyplot):
      """Check that we raise a `NotFittedError` when the passed regressor is not
      fit."""
      regressor = Ridge()
      with pytest.raises(NotFittedError, match="is not fitted yet."):
          PredictionErrorDisplay.from_estimator(regressor, X, y)
  
file_path: scikit-learn/sklearn/metrics/_plot/tests/test_predict_error_display.py
imports: import pytest
  from numpy.testing import assert_allclose
  from sklearn.datasets import load_diabetes
  from sklearn.exceptions import NotFittedError
  from sklearn.linear_model import Ridge
  from sklearn.metrics import PredictionErrorDisplay
label_desc: Use image node_id 3 for calling a global function with example usage: test_from_estimator_not_fitted(pyplot) without return types