code: def test_dense_annoy_index(annoy_index_file):
      data = np.random.choice([0, 1], size=(10, 5))
      index = build_annoy_index(data, annoy_index_file)
      assert os.path.exists(annoy_index_file)
  
      loaded_index = AnnoyIndex(5, metric="angular")
      loaded_index.load(annoy_index_file)
  
      assert index.f == loaded_index.f == 5
      assert index.get_n_items() == loaded_index.get_n_items() == 10
      assert index.get_nns_by_item(
          0, 5
      ) == loaded_index.get_nns_by_item(0, 5)
  
      index.unload()
      loaded_index.unload()
  
file_path: ivis/tests/data/test_knn.py
imports: import tempfile
  import os
  import pytest
  from annoy import AnnoyIndex
  from scipy.sparse import csr_matrix
  from sklearn import datasets
  import numpy
  from ivis.data.neighbour_retrieval import AnnoyKnnMatrix
  from ivis.data.neighbour_retrieval.knn import build_annoy_index, extract_knn
label_desc: Use image node_id 3 for calling a global function with example usage: test_dense_annoy_index(annoy_index_file) without return types