code: def _test_metric_parameters(distance_func: Callable):
      """Test to ensure custom distances can be used."""
  
      @njit()
      def _standalone_numba_distance(x, y) -> float:
          return 5.0
  
      class _ValidTestClass(NumbaDistance):
          @staticmethod
          @njit()
          def _numba_distance(x, y) -> float:
              return _standalone_numba_distance(x, y)
  
          def _distance_factory(
              self, x: np.ndarray, y: np.ndarray, **kwargs: dict
          ) -> DistanceCallable:
              return _ValidTestClass._numba_distance
  
      x_numpy = create_test_distance_numpy(10, 10)
      y_numpy = create_test_distance_numpy(10, 10, random_state=2)
  
      class_result = distance_func(
          x_numpy, y_numpy, metric=_ValidTestClass()
      )
      standalone_dist_result = distance_func(
          x_numpy, y_numpy, metric=_standalone_numba_distance
      )
  
      if isinstance(class_result, float) or class_result.shape == (
          1,
          1,
      ):
          expected = 5.0
          assert class_result == expected, (
              f"Using a custom NumbaDistance did not produce the expected result. Ensure"
              f"custom NumbaDistances can be passed. Expected result {expected}, got "
              f"{class_result}"
          )
  
          assert standalone_dist_result == expected, (
              f"Using a custom no_python compiled distance function did not produce the"
              f"expected result. Ensure no_python compiled functions can be passed. "
              f"Expected result {expected}, got {class_result}"
          )
      else:
          expected = 50.0
          assert class_result.trace() == expected, (
              f"Using a custom NumbaDistance did not produce the expected result. Ensure"
              f"custom NumbaDistances can be passed. Expected result {expected}, got "
              f"{class_result.trace()}"
          )
  
          assert standalone_dist_result.trace() == expected, (
              f"Using a custom no_python compiled distance function did not produce the"
              f"expected result. Ensure no_python compiled functions can be passed."
              f"Expected result {expected}, got {class_result.trace()}"
          )
  
imports: from typing import Callable
  import numpy
  import pytest
  from sktime.distances.base import DistanceCallable, NumbaDistance
  from sktime.distances.tests._utils import create_test_distance_numpy
  from sktime.utils.numba.njit import njit
label_desc: Use image node_id 1 for calling a global function with example usage: _test_metric_parameters(distance_func) and returns: int, _standalone_numba_distance, _ValidTestClass