code: def test_get_metric_is_independent_from_metric_learner(
      estimator, build_dataset
  ):
      """Tests that the get_metric method returns a function that is independent
      from the original metric learner"""
      input_data, labels, _, X = build_dataset()
      model = clone(estimator)
      set_random_state(model)
  
      # we fit the metric learner on it and then we compute the metric on some
      # points
      model.fit(*remove_y(model, input_data, labels))
      metric = model.get_metric()
      score = metric(X[0], X[1])
  
      # then we refit the estimator on another dataset
      model.fit(*remove_y(model, np.sin(input_data), labels))
  
      # we recompute the distance between the two points: it should be the same
      score_bis = metric(X[0], X[1])
      assert score_bis == score
  
imports: from numpy.core.numeric import array_equal
  import pytest
  import re
  import unittest
  import metric_learn
  import numpy
  from sklearn import clone
  from test.test_utils import ids_metric_learners, metric_learners, remove_y
  from metric_learn.sklearn_shims import set_random_state, SKLEARN_AT_LEAST_0_22
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_metric_is_independent_from_metric_learner(estimator, build_dataset) without return types