code: def test_mem_map_dataset_index_mapping_dir(
      tmp_path,
      dataset_class,
      jsonl_file,
      use_alternative_index_mapping_dir,
      relative_index_fn,
  ):
      """Test for index_mapping_dir."""
      if relative_index_fn:
          jsonl_file = os.path.relpath(jsonl_file)
      else:
          jsonl_file = os.path.abspath(jsonl_file)
  
      if use_alternative_index_mapping_dir:
          index_mapping_dir = tmp_path / "subdir"
          dataset_class(
              dataset_paths=[jsonl_file],
              header_lines=0,
              index_mapping_dir=str(index_mapping_dir),
          )
          # Index files should not be created in default location.
          assert not os.path.isfile(f"{jsonl_file}.idx.npy")
          assert not os.path.isfile(f"{jsonl_file}.idx.info")
          if relative_index_fn:
              # Remove leading ".." sequences.
              while jsonl_file.startswith(("../")):
                  jsonl_file = jsonl_file.lstrip("../")
          idx_fn = f"{str(index_mapping_dir)}/{jsonl_file}.idx"
          assert os.path.isfile(f"{idx_fn}.npy")
          assert os.path.isfile(f"{idx_fn}.info")
      else:
          text_memmap_dataset.JSONLMemMapDataset(
              dataset_paths=[jsonl_file], header_lines=0
          )
          assert os.path.isfile(f"{jsonl_file}.idx.npy")
          assert os.path.isfile(f"{jsonl_file}.idx.info")
  
file_path: NeMo/tests/collections/nlp/test_mem_map_dataset.py
imports: import csv
  import json
  import os
  import pytest
  from nemo.collections.nlp.data.language_modeling import text_memmap_dataset
label_desc: Use image node_id 6 for calling a global function with example usage: test_mem_map_dataset_index_mapping_dir(tmp_path, dataset_class, jsonl_file, use_alternative_index_mapping_dir, relative_index_fn) without return types