code: def check_distance_symmetry(test_obj, distance):
      for k in range(100):
          x = numpy.random.randn(10)
          y = numpy.random.randn(10)
          d_xy = distance.distance(x, y)
          d_yx = distance.distance(y, x)
  
          # I had precision issues with a local install. This test is more tolerant to that.
          test_obj.assertAlmostEqual(d_xy, d_yx, delta=0.00000000000001)
  
      for k in range(100):
          x = scipy.sparse.rand(30, 1, density=0.3)
          y = scipy.sparse.rand(30, 1, density=0.3)
          d_xy = distance.distance(x, y)
          d_yx = distance.distance(y, x)
  
          # I had precision issues with a local install. This test is more tolerant to that.
          test_obj.assertAlmostEqual(d_xy, d_yx, delta=0.00000000000001)
  
file_path: NearPy/tests/distances_tests.py
imports: import numpy
  import scipy
  import unittest
  from nearpy.distances import EuclideanDistance, CosineDistance, ManhattanDistance
label_desc: Use image node_id 1 for calling a global function with example usage: check_distance_symmetry(test_obj, distance) without return types