code: def test_check_is_fitted(method):
      # Check that predict raises an exception in an unfitted estimator.
      # Unfitted estimators should raise a NotFittedError.
      rng = np.random.RandomState(0)
      X = rng.randn(10, 2)
      kde = KernelDensity()
  
      with pytest.raises(NotFittedError):
          getattr(kde, method)(X)
  
imports: import joblib
  import numpy
  import pytest
  from sklearn.datasets import make_blobs
  from sklearn.exceptions import NotFittedError
  from sklearn.model_selection import GridSearchCV
  from sklearn.neighbors import KDTree, KernelDensity, NearestNeighbors
  from sklearn.neighbors._ball_tree import kernel_norm
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import StandardScaler
  from sklearn.utils._testing import assert_allclose
label_desc: Use image node_id 11 for calling a global function with example usage: test_check_is_fitted(method) without return types