code: def test_index(pool_params, distance):
      pool = Pool.from_file(
          pool_params["pool_file"], pool_params["component_type"], 10
      )
      hnsw = Hnsw()
      hnsw.build(
          pool,
          distance,
          level_size_decay=2,
          max_neighbors=5,
          search_neighborhood_size=30,
          batch_size=10,
          upper_level_batch_size=10,
          num_exact_candidates=10,
          num_threads=1,
      )
      index_path = yatest.common.test_output_path("index")
      hnsw.save(index_path)
      hnsw.load(index_path, pool, distance)
      neighbors = hnsw.get_nearest(pool.get_item(0), 20, 40)
      log_path = yatest.common.test_output_path("log")
      with open(log_path, "w") as log_file:
          for neighbor in neighbors:
              print(neighbor, file=log_file)
      return [
          yatest.common.canonical_file(index_path, local=True),
          yatest.common.canonical_file(log_path, local=True),
      ]
  
imports: from __future__ import print_function
  import pytest
  import os
  import numpy
  import yatest.common
  import struct
  from hnsw import EVectorComponentType, EDistance, Pool, Hnsw, HnswException, transform_mobius, HnswEstimator, OnlineHnsw
label_desc: Use image node_id 2 for calling a global function with example usage: test_index(pool_params, distance) and returns: list