code: def test_raise_not_fitted_error_if_not_fitted(
      estimator, build_dataset, with_preprocessor
  ):
      """Test that a NotFittedError is raised if someone tries to use
      pair_score, score_pairs, decision_function, get_metric, transform or
      get_mahalanobis_matrix on input data and the metric learner
      has not been fitted."""
      input_data, labels, preprocessor, _ = build_dataset(
          with_preprocessor
      )
      estimator = clone(estimator)
      estimator.set_params(preprocessor=preprocessor)
      set_random_state(estimator)
      with pytest.raises(NotFittedError):  # Remove in 0.8.0
          estimator.score_pairs(input_data)
      with pytest.raises(NotFittedError):
          estimator.pair_score(input_data)
      with pytest.raises(NotFittedError):
          estimator.decision_function(input_data)
      with pytest.raises(NotFittedError):
          estimator.get_metric()
      with pytest.raises(NotFittedError):
          estimator.transform(input_data)
      with pytest.raises(NotFittedError):
          estimator.get_mahalanobis_matrix()
      with pytest.raises(NotFittedError):
          estimator.calibrate_threshold(input_data, labels)
  
      with pytest.raises(NotFittedError):
          estimator.set_threshold(0.5)
      with pytest.raises(NotFittedError):
          estimator.predict(input_data)
  
imports: from functools import partial
  import pytest
  from numpy.testing import assert_array_equal
  from scipy.spatial.distance import euclidean
  from metric_learn.base_metric import _PairsClassifierMixin, MahalanobisMixin
  from sklearn.exceptions import NotFittedError
  from sklearn.metrics import f1_score, accuracy_score, fbeta_score, precision_score
  from sklearn.model_selection import train_test_split
  from test.test_utils import pairs_learners, ids_pairs_learners
  from metric_learn.sklearn_shims import set_random_state
  from sklearn import clone
  import numpy
  from itertools import product
label_desc: Use image node_id 3 for calling a global function with example usage: test_raise_not_fitted_error_if_not_fitted(estimator, build_dataset, with_preprocessor) without return types