code: def test_fails_if_neither_data_nor_index_specified(self):
      for method_name, cls in AFFINITY_CLASSES:
          with self.assertRaises(ValueError, msg=method_name):
              cls(data=None, knn_index=None)
  
imports: import logging
  import unittest
  from functools import partial
  import numpy
  from scipy.spatial.distance import squareform, pdist
  from sklearn import datasets
  from sklearn.model_selection import train_test_split
  from openTSNE import affinity, nearest_neighbors
label_desc: Use image node_id 2 for calling the TestAffinityAcceptsKnnIndexAsParameter obj's underlying member method code with example usage: obj.test_fails_if_neither_data_nor_index_specified() without return types