code: def test_samplingpath():
      x0 = np.array([0.5, 0.5])
      v0 = np.array([0.1, 0.0])
      L0 = 0.0
      path = SamplingPath(x0, v0, L0)
      assert path.interpolate(0) == (x0, v0, L0, True)
      try:
          path.interpolate(1)
          assert False
      except KeyError:
          pass
      try:
          path.interpolate(-1)
          assert False
      except KeyError:
          pass
  
      path.add(-1, x0 - v0, v0, 1.0)
      x1, v1, L1, on_path = path.interpolate(-1)
      assert_allclose(x1, x0 - v0)
      assert_allclose(v1, v0)
      assert_allclose(L1, 1.0)
      assert on_path
  
      path.add(4, x0 + 4 * v0, v0, 4.0)
      x1, v1, L1, on_path = path.interpolate(1)
      assert_allclose(x1, x0 + v0)
      assert_allclose(v1, v0)
      assert L1 is None, L1
      assert on_path
  
file_path: ultranest/tests/test_samplingpath.py
imports: import numpy
  import matplotlib.pyplot
  from ultranest.mlfriends import AffineLayer, MLFriends
  from ultranest.samplingpath import SamplingPath, ContourSamplingPath
  from ultranest.samplingpath import box_line_intersection, nearest_box_intersection_line, linear_steps_with_reflection, angle, get_sphere_tangents, norm
  from numpy.testing import assert_allclose
label_desc: Use image node_id 6 for calling a global function with example usage: test_samplingpath() without return types