code: def test_range_errors(n_points=1000, n_trees=10):
      f = 10
      i = AnnoyIndex(f, "euclidean")
      for j in range(n_points):
          i.add_item(j, [random.gauss(0, 1) for x in range(f)])
      with pytest.raises(IndexError):
          i.add_item(-1, [random.gauss(0, 1) for x in range(f)])
      i.build(n_trees)
      for bad_index in [-1000, -1, n_points, n_points + 1000]:
          with pytest.raises(IndexError):
              i.get_distance(0, bad_index)
          with pytest.raises(IndexError):
              i.get_nns_by_item(bad_index, 1)
          with pytest.raises(IndexError):
              i.get_item_vector(bad_index)
  
file_path: annoy/test/types_test.py
imports: import random
  import numpy
  import pytest
  from annoy import AnnoyIndex
label_desc: Use image node_id 4 for calling a global function with example usage: test_range_errors(n_points, n_trees) without return types