class_docstr: Unit tests for OIVF. Some of these unit tests first copy the required test data objects and puts them in the tempdir created by the context manager.
class_docstr_tok: ["Unit","tests","for","OIVF",".","Some","of","these","unit","tests","first","copy","the","required","test","data","objects","and","puts","them","in","the","tempdir","created","by","the","context","manager","."]
docstr: Test search step using test data objects to bypass dependencies on previous steps.
docstr_tok: ["Test","search","step","using","test","data","objects","to","bypass","dependencies","on","previous","steps","."]
code: def test_search(self) -> None:
      """
      Test search step using test data objects to bypass dependencies on previous steps.
      """
      with tempfile.TemporaryDirectory() as tmpdirname:
          num_files = 3
          file_size = 10000
          query_batch_size = 10000
          total_batches = num_files * file_size // query_batch_size
          if num_files * file_size % query_batch_size != 0:
              total_batches += 1
          data_creator = TestDataCreator(
              tempdir=tmpdirname,
              dimension=8,
              data_type=np.float32,
              index_factory=["IVF256,PQ4"],
              training_sample=9984,
              num_files=3,
              file_size=10000,
              nprobe=2,
              k=2,
              metric="METRIC_L2",
              index_shard_size=10000,
              query_batch_size=query_batch_size,
              evaluation_sample=100,
          )
          data_creator.create_test_data()
          test_args = data_creator.setup_cli("train_index")
          process_options_and_run_jobs(test_args)
          test_args = data_creator.setup_cli("index_shard")
          process_options_and_run_jobs(test_args)
          test_args = data_creator.setup_cli("search")
          cfg = load_config(test_args.config)
          process_options_and_run_jobs(test_args)
          # TODO: add check that there are number of batches total of files
          knn_file = cfg["output"] + KNN_RESULTS_FILE
          self.assert_file_exists(knn_file)
  
file_path: faiss/demos/offline_ivf/tests/test_offline_ivf.py
imports: import numpy
  import unittest
  from utils import load_config
  import pathlib
  import tempfile
  from typing import List
  from tests.testing_utils import TestDataCreator
  from run import process_options_and_run_jobs
label_desc: Use image node_id 6 for calling the TestOIVF obj's underlying member method code with example usage: obj.test_search() without return types