code: def test_many_vectors():
      f = 10
      i = AnnoyIndex(f, "hamming")
      for x in range(100000):
          i.add_item(x, numpy.random.binomial(1, 0.5, f))
      i.build(10)
  
      rs, ds = i.get_nns_by_vector(
          [0] * f, 10000, include_distances=True
      )
      assert min(ds) >= 0
      assert max(ds) <= f
  
      dists = []
      for x in range(1000):
          rs, ds = i.get_nns_by_vector(
              numpy.random.binomial(1, 0.5, f),
              1,
              search_k=1000,
              include_distances=True,
          )
          dists.append(ds[0])
      avg_dist = 1.0 * sum(dists) / len(dists)
      assert avg_dist <= 0.42
  
file_path: annoy/test/hamming_index_test.py
imports: import numpy
  import pytest
  from annoy import AnnoyIndex
label_desc: Use image node_id 4 for calling a global function with example usage: test_many_vectors() without return types