code: def test_validate_calibration_params_invalid_parameters_error_before__fit(
      estimator, build_dataset
  ):
      """For all pairs metric learners (which currently all have a _fit method),
      make sure that calibration parameters are validated before fitting
      """
      estimator = clone(estimator)
      input_data, labels, _, _ = build_dataset()
  
      def breaking_fun(
          **args,
      ):  # a function that fails so that we will miss
          # the calibration at the end and therefore the right error message from
          # validating params should be thrown before
          raise RuntimeError("Game over.")
  
      estimator._fit = breaking_fun
      expected_msg = (
          'Strategy can either be "accuracy", "f_beta" or '
          '"max_tpr" or "max_tnr". Got "weird" instead.'
      )
      with pytest.raises(ValueError) as raised_error:
          estimator.fit(
              input_data,
              labels,
              calibration_params={"strategy": "weird"},
          )
      assert str(raised_error.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 20 for calling a global function with example usage: test_validate_calibration_params_invalid_parameters_error_before__fit(estimator, build_dataset) without return types