code: def test_cosine_distance_query(self):
      k = 15
      # Compute cosine distance nearest neighbors using ball tree
      knn_index = self.knn_index(self.x1, k, "cosine")
      knn_index.build()
  
      indices, distances = knn_index.query(self.x2, k=k)
  
      # Compute the exact nearest neighbors as a reference
      true_distances = cdist(self.x2, self.x1, metric="cosine")
      true_indices_ = np.argsort(true_distances, axis=1)[:, :k]
      true_distances_ = np.vstack(
          [d[i] for d, i in zip(true_distances, true_indices_)]
      )
  
      np.testing.assert_array_equal(
          indices,
          true_indices_,
          err_msg="Nearest neighbors do not match",
      )
      np.testing.assert_array_equal(
          distances, true_distances_, err_msg="Distances do not match"
      )
  
imports: import pickle
  import platform
  import tempfile
  import unittest
  from os import path
  from unittest.mock import patch, MagicMock
  import numpy
  import scipy.sparse
  from scipy.spatial.distance import pdist, cdist, squareform
  from sklearn import datasets
  from sklearn.utils import check_random_state
  from openTSNE import nearest_neighbors
  from openTSNE.utils import is_package_installed
  from .test_tsne import check_mock_called_with_kwargs
label_desc: Use image node_id 2 for calling the TestSklearn obj's underlying member method code with example usage: obj.test_cosine_distance_query() without return types