docstr: Test with paths on AIStore.
          
docstr_tok: ["Test","with","paths","on","AIStore","."]
code: def test_get_full_path_ais(self, tmpdir):
      """Test with paths on AIStore."""
      # Create a few files
      num_files = 10
  
      audio_files_relative_path = [
          f"file_{n}.test" for n in range(num_files)
      ]
      audio_files_cache_path = [
          os.path.join(tmpdir, a_file_rel)
          for a_file_rel in audio_files_relative_path
      ]
  
      ais_data_dir = "ais://test"
      ais_manifest_file = os.path.join(ais_data_dir, "manifest.json")
  
      # Context manager to create dummy files
      @contextmanager
      def create_files(paths):
          # Create files
          for a_file in paths:
              Path(a_file).touch()
          yield
          # Remove files
          for a_file in paths:
              Path(a_file).unlink()
  
      # Simulate caching in local tmpdir
      def datastore_path_to_cache_path_in_tmpdir(path):
          rel_path = os.path.relpath(
              path, start=os.path.dirname(ais_manifest_file)
          )
  
          if rel_path in audio_files_relative_path:
              idx = audio_files_relative_path.index(rel_path)
              return audio_files_cache_path[idx]
          else:
              raise ValueError(f"Unexpected path {path}")
  
      with mock.patch(
          "nemo.collections.common.parts.preprocessing.manifest.datastore_path_to_local_path",
          datastore_path_to_cache_path_in_tmpdir,
      ):
          # Test with relative paths and existing cached files.
          # We expect to return the absolute path in the local cache.
          with create_files(audio_files_cache_path):
              # - single file
              for n in range(num_files):
                  assert (
                      get_full_path(
                          audio_files_relative_path[n],
                          manifest_file=ais_manifest_file,
                      )
                      == audio_files_cache_path[n]
                  )
                  assert (
                      get_full_path(
                          audio_files_relative_path[n],
                          data_dir=ais_data_dir,
                      )
                      == audio_files_cache_path[n]
                  )
  
              # - all files in a list
              assert (
                  get_full_path(
                      audio_files_relative_path,
                      manifest_file=ais_manifest_file,
                  )
                  == audio_files_cache_path
              )
              assert (
                  get_full_path(
                      audio_files_relative_path, data_dir=ais_data_dir
                  )
                  == audio_files_cache_path
              )
  
file_path: NeMo/tests/collections/common/test_utils.py
imports: import os
  import string
  from contextlib import contextmanager
  from pathlib import Path
  from unittest import mock
  import numpy
  import pytest
  from nemo.collections.common.parts.preprocessing.manifest import get_full_path, is_tarred_dataset
  from nemo.collections.common.parts.utils import flatten
label_desc: Use image node_id 2 for calling the TestPreprocessingUtils obj's underlying member method code with example usage: obj.test_get_full_path_ais(tmpdir) and returns: audio_files_cache_path