code: def test_surrogate_array_4d_write():
      """Run the 4D data generation; check that output images are written"""
      from os import path
      from tempfile import mkdtemp
  
      n_sess = 3
      write_paths = [
          path.join(mkdtemp(), "img_%d.nii" % i) for i in range(n_sess)
      ]
      shape = (5, 6, 7)
      imgs = surrogate_4d_dataset(shape, out_image_file=write_paths[0])
      assert path.isfile(write_paths[0])
      imgs = surrogate_4d_dataset(
          shape, n_sess=n_sess, out_image_file=write_paths
      )
      for wp in write_paths:
          assert path.isfile(wp)
  
file_path: nipy/nipy/labs/utils/tests/test_simul_multisubject_fmri_dataset.py
imports: import numpy
  from nibabel import Nifti1Image
  from ..simul_multisubject_fmri_dataset import surrogate_2d_dataset, surrogate_3d_dataset, surrogate_4d_dataset
label_desc: Use image node_id 6 for calling a global function with example usage: test_surrogate_array_4d_write() without return types