code: def test_fit_with_valid_threshold_params(
      estimator, build_dataset, with_preprocessor, calibration_params
  ):
      """Tests that fitting `calibration_params` with appropriate parameters works
      as expected"""
      pairs, y, preprocessor, _ = build_dataset(with_preprocessor)
      estimator = clone(estimator)
      estimator.set_params(preprocessor=preprocessor)
      set_random_state(estimator)
      estimator.fit(pairs, y, calibration_params=calibration_params)
      estimator.predict(pairs)
  
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 4 for calling a global function with example usage: test_fit_with_valid_threshold_params(estimator, build_dataset, with_preprocessor, calibration_params) without return types