code: def test_unset_threshold():
      """Tests that the "threshold is unset" error is raised when using predict
      (performs binary classification on pairs) with an unset threshold.
      """
      identity_pairs_classifier = IdentityPairsClassifier()
      pairs = np.array(
          [
              [[0.0], [1.0]],
              [[1.0], [3.0]],
              [[2.0], [5.0]],
              [[3.0], [7.0]],
          ]
      )
      y = np.array([1, 1, -1, -1])
      identity_pairs_classifier.fit(pairs, y)
      with pytest.raises(AttributeError) as e:
          identity_pairs_classifier.predict(pairs)
  
      expected_msg = (
          "A threshold for this estimator has not been set, "
          "call its set_threshold or calibrate_threshold method."
      )
  
      assert str(e.value) == expected_msg
  
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 6 for calling a global function with example usage: test_unset_threshold() without return types