code: def test_distance_consistency():
      n, f = 1000, 3
      i = AnnoyIndex(f, "manhattan")
      for j in range(n):
          i.add_item(j, numpy.random.normal(size=f))
      i.build(10)
      for a in random.sample(range(n), 100):
          indices, dists = i.get_nns_by_item(
              a, 100, include_distances=True
          )
          for b, dist in zip(indices, dists):
              assert dist == pytest.approx(i.get_distance(a, b))
              u = numpy.array(i.get_item_vector(a))
              v = numpy.array(i.get_item_vector(b))
              assert dist == pytest.approx(numpy.sum(numpy.fabs(u - v)))
              assert dist == pytest.approx(
                  sum([abs(float(x) - float(y)) for x, y in zip(u, v)])
              )
  
file_path: annoy/test/manhattan_index_test.py
imports: import random
  import numpy
  import pytest
  from annoy import AnnoyIndex
label_desc: Use image node_id 12 for calling a global function with example usage: test_distance_consistency() without return types