code: def test_get_metric_works_does_not_raise(estimator, build_dataset):
      """Tests that the metric returned by get_metric does not raise errors (or
      warnings) similarly to the distance functions in scipy.spatial.distance
      """
      input_data, labels, _, X = build_dataset()
      model = clone(estimator)
      set_random_state(model)
      model.fit(*remove_y(model, input_data, labels))
      metric = model.get_metric()
  
      list_test_get_metric_doesnt_raise = [
          (X[0], X[1]),
          (X[0].tolist(), X[1].tolist()),
          (X[0][None], X[1][None]),
      ]
  
      for u, v in list_test_get_metric_doesnt_raise:
          with pytest.warns(None) as record:
              metric(u, v)
          assert len(record) == 0
  
      # Test that the scalar case works
      model.components_ = np.array([3.1])
      metric = model.get_metric()
      for u, v in [(5, 6.7), ([5], [6.7]), ([[5]], [[6.7]])]:
          with pytest.warns(None) as record:
              metric(u, v)
          assert len(record) == 0
  
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 5 for calling a global function with example usage: test_get_metric_works_does_not_raise(estimator, build_dataset) without return types