code: def test(self):
      ds = datasets.SyntheticDataset(32, 1000, 100, 20)
      index = faiss.index_factory(ds.d, "IVF32,Flat")
      index.train(ds.get_train())
      k = 10
      rs = np.random.RandomState(123)
      subset = rs.choice(ds.nb, 50, replace=False)
  
      params = faiss.SearchParametersIVF(
          sel=faiss.IDSelectorBatch(subset), nprobe=4
      )
  
      Dref, Iref = index.search(ds.get_queries(), k, params=params)
  
      def is_member(idx):
          return idx in subset
  
      params = faiss.SearchParametersIVF(
          sel=faiss.PyCallbackIDSelector(is_member), nprobe=4
      )
  
      Dnew, Inew = index.search(ds.get_queries(), k, params=params)
  
      np.testing.assert_array_equal(Iref, Inew)
      np.testing.assert_almost_equal(Dref, Dnew, decimal=5)
  
imports: import numpy
  import faiss
  import unittest
  import sys
  import gc
  from faiss.contrib import datasets
  from faiss.contrib.evaluation import sort_range_res_2, check_ref_range_results
label_desc: Use image node_id 1 for calling the TestSelectorCallback obj's underlying member method code with example usage: obj.test() and returns: unknown