code: def test_index_save_load_restore_copy(ndim, quantization, batch_size):
      index = Index(ndim=ndim, dtype=quantization, multi=False)
  
      if batch_size > 0:
          keys = np.arange(batch_size)
          vectors = random_vectors(count=batch_size, ndim=ndim)
          index.add(keys, vectors, threads=threads)
  
      index.save("tmp.usearch")
      index.clear()
      assert len(index) == 0
      assert os.path.exists("tmp.usearch")
  
      index.load("tmp.usearch")
      assert len(index) == batch_size
      if batch_size > 0:
          assert len(index[0].flatten()) == ndim
  
      index_meta = Index.metadata("tmp.usearch")
      assert index_meta is not None
  
      index = Index.restore("tmp.usearch", view=False)
      assert len(index) == batch_size
      if batch_size > 0:
          assert len(index[0].flatten()) == ndim
  
      copied_index = index.copy()
      assert len(copied_index) == len(index)
      if batch_size > 0:
          assert np.allclose(
              np.vstack(copied_index.get(keys)),
              np.vstack(index.get(keys)),
          )
  
      # Perform the same operations in RAM, without touching the filesystem
      serialized_index = index.save()
      deserialized_metadata = Index.metadata(serialized_index)
      assert deserialized_metadata is not None
  
      deserialized_index = Index.restore(serialized_index)
      assert len(deserialized_index) == len(index)
      assert set(np.array(deserialized_index.keys)) == set(
          np.array(index.keys)
      )
      if batch_size > 0:
          assert np.allclose(
              np.vstack(deserialized_index.get(keys)),
              np.vstack(index.get(keys)),
          )
  
      deserialized_index.reset()
      index.reset()
      os.remove("tmp.usearch")
  
file_path: usearch/python/scripts/test_index.py
imports: import os
  import pytest
  import numpy
  from usearch.io import load_matrix, save_matrix
  from usearch.eval import random_vectors
  from usearch.index import search
  from usearch.index import Index, MetricKind, ScalarKind, Match, Matches, BatchMatches, Clustering
  from usearch.index import DEFAULT_CONNECTIVITY
label_desc: Use image node_id 6 for calling a global function with example usage: test_index_save_load_restore_copy(ndim, quantization, batch_size) without return types