code: def test_knn_matrix_construction_params(annoy_index_file):
      # Test too large k raises exception
      with pytest.raises(Exception):
          AnnoyKnnMatrix.build(
              np.zeros(shape=(4, 4)), annoy_index_file, k=4
          )
      with pytest.raises(Exception):
          AnnoyKnnMatrix.load(annoy_index_file, (4, 4), k=4)
  
      index = AnnoyKnnMatrix.build(
          np.zeros(shape=(4, 4)), annoy_index_file, k=2
      )
      loaded_index = AnnoyKnnMatrix.load(annoy_index_file, (4, 4), k=2)
  
      for original_row, loaded_row in zip(index, loaded_index):
          assert original_row == loaded_row
  
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 5 for calling a global function with example usage: test_knn_matrix_construction_params(annoy_index_file) without return types