code: def test_found_score_is_best_score(kwargs, scoring):
      # test that when we use calibrate threshold, it will indeed be the
      # threshold that have the best score
      rng = np.random.RandomState(42)
      n_samples = 50
      pairs, y = rng.randn(n_samples, 2, 5), rng.choice(
          [-1, 1], size=n_samples
      )
      pairs_learner = IdentityPairsClassifier()
      pairs_learner.fit(pairs, y)
      pairs_learner.calibrate_threshold(pairs, y, **kwargs)
      best_score = scoring(y, pairs_learner.predict(pairs))
      scores = []
      predicted_scores = pairs_learner.decision_function(pairs)
      predicted_scores = np.hstack(
          [
              [np.min(predicted_scores) - 1],
              predicted_scores,
              [np.max(predicted_scores) + 1],
          ]
      )
      for threshold in -predicted_scores:
          pairs_learner.set_threshold(threshold)
          score = scoring(y, pairs_learner.predict(pairs))
          assert score <= best_score
          scores.append(score)
      assert len(set(scores)) > 1
  
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 13 for calling a global function with example usage: test_found_score_is_best_score(kwargs, scoring) without return types