code: def test_threshold_different_scores_is_finite(
      estimator, build_dataset, with_preprocessor, kwargs
  ):
      # test that calibrating the threshold works for every metric learner
      input_data, labels, preprocessor, _ = build_dataset(
          with_preprocessor
      )
      estimator = clone(estimator)
      estimator.set_params(preprocessor=preprocessor)
      set_random_state(estimator)
      estimator.fit(input_data, labels)
      with pytest.warns(None) as record:
          estimator.calibrate_threshold(input_data, labels, **kwargs)
      assert len(record) == 0
  
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 5 for calling a global function with example usage: test_threshold_different_scores_is_finite(estimator, build_dataset, with_preprocessor, kwargs) without return types