code: def test_correctness(dist, uni_multi):
      """Test dtw correctness on:
  
      uni_multi = "uni" -> UnitTest: univariate, equal length.
      uni_multi = "multi" -> BasicMotions: multivariate, equal length.
      """
      # skip test if distance function/class have not changed
      if not run_test_for_class(
          [dist.dist_func, dist.dist_instance.__class__]
      ):
          return None
  
      # msm distance is not implemented for multivariate
      if uni_multi == "multi" and dist.canonical_name in ["msm"]:
          return None
  
      dist_str = dist.canonical_name
      dist = dist.dist_func
  
      if uni_multi == "uni":
          loader = load_unit_test
          ind2 = 2
          expected = unit_test_distances
      else:
          loader = load_basic_motions
          ind2 = 1
          expected = basic_motions_distances
  
      trainX, _ = loader(return_type="numpy3D")
  
      # test parameters
      if dist_str in distance_param_name:
          params_multi = distance_parameters[dist_str]
          param_list = [
              {distance_param_name[dist_str]: x} for x in params_multi
          ]
      else:
          param_list = [{}]
  
      # assert distance between fixtures d, d2 are same as expected
      for j, param in enumerate(param_list):
          # deal with custom setting of epsilon in multi
          # this was in the original test before refactoring
          if "epsilon" in param and uni_multi == "multi":
              param = {"epsilon": param["epsilon"] / 50}
          # check that distance is same as expected
          d = dist(trainX[0], trainX[ind2], **param)
          d2 = dist(trainX[0], trainX[ind2], **param)
          assert_almost_equal(d, expected[dist_str][j], 4)
          assert d == d2
  
imports: import pytest
  from numpy.testing import assert_almost_equal
  from sktime.datasets import load_basic_motions, load_unit_test
  from sktime.distances._distance import _METRIC_INFOS
  from sktime.tests.test_switch import run_test_for_class
  from sktime.utils.validation._dependencies import _check_soft_dependencies
label_desc: Use image node_id 1 for calling a global function with example usage: test_correctness(dist, uni_multi) and returns: None, None