code: def test_repr_niimgs_with_niimg_pathlib():
      # Tests with pathlib
      # Case with very long path and small filename
      long_path = Path("/this/is/a/fake/long/path/to/file.nii")
      short_path = Path(".../path/to/file.nii")
      assert _utils._repr_niimgs(long_path, shorten=True) == str(
          short_path
      )
      assert _utils._repr_niimgs(long_path, shorten=False) == str(
          long_path
      )
  
      # Case with very long path but very long filename
      long_path_long_name = Path(
          "/this/is/a/fake/long/path/to/my_file_with_a_very_long_name.nii"
      )
      short_name = "my_file_with_a_ver..."
      assert (
          _utils._repr_niimgs(long_path_long_name, shorten=True)
          == short_name
      )
      assert _utils._repr_niimgs(
          long_path_long_name, shorten=False
      ) == str(long_path_long_name)
  
      # Case with lists
      list_of_paths = [
          Path("/this/is/a/fake/long/path/to/file.nii"),
          Path("/this/is/a/fake/long/path/to/another/file2.nii"),
          Path("/again/another/fake/long/path/to/file3.nii"),
          Path(
              "/this/is/a/fake/long/path/to/a-very-long-file-name.nii"
          ),
      ]
  
      shortened_list_of_paths = (
          f"[...{str(Path('/path/to/file.nii'))},\n"
          f"         ...\n"
          f" a-very-long-file-n...]"
      )
  
      assert (
          _utils._repr_niimgs(list_of_paths, shorten=True)
          == shortened_list_of_paths
      )
      long_list_of_paths = ",\n ".join([str(_) for _ in list_of_paths])
      long_list_of_paths = f"[{long_list_of_paths}]"
      assert (
          _utils._repr_niimgs(list_of_paths, shorten=False)
          == long_list_of_paths
      )
  
imports: import os
  import re
  import tempfile
  from pathlib import Path
  import nibabel
  import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_equal
  import nilearn
  from nilearn import _utils
  from nilearn._utils import niimg_conversions, testing
  from nilearn._utils.exceptions import DimensionError
  from nilearn._utils.niimg_conversions import iter_check_niimg
  from nilearn._utils.testing import assert_memory_less_than, with_memory_profiler
  from nilearn.image import get_data
label_desc: Use image node_id 17 for calling a global function with example usage: test_repr_niimgs_with_niimg_pathlib() without return types