code: def test_fmri_inputs(
      tmp_path, rng, confounds, shape_3d_default, shape_4d_default
  ):
      # Test processing of FMRI inputs
      # prepare fake data
      mask, niimg, des = generate_fake_fmri_data_and_design(
          [shape_4d_default], 1
      )
  
      # prepare correct input first level models
      flm = FirstLevelModel(subject_label="01").fit(
          niimg, design_matrices=des
      )
  
      # prepare correct input dataframe and lists
      p, q = 80, 10
      X = rng.standard_normal(size=(p, q))
      sdes = pd.DataFrame(X[:3, :3], columns=["intercept", "b", "c"])
  
      # smoke tests with correct input
      flms = [flm, flm, flm]
  
      shape_3d = [shape_3d_default + (1,)]
      _, FUNCFILE, _ = write_fake_fmri_data_and_design(
          shape_3d, file_path=tmp_path
      )
      FUNCFILE = FUNCFILE[0]
      niimgs = [FUNCFILE, FUNCFILE, FUNCFILE]
      niimg_4d = concat_imgs(niimgs)
  
      # First level models as input
      SecondLevelModel(mask_img=mask).fit(flms)
      SecondLevelModel().fit(flms)
      # Note : the following one creates a singular design matrix
      SecondLevelModel().fit(flms, confounds)
      SecondLevelModel().fit(flms, None, sdes)
  
      # niimgs as input
      SecondLevelModel().fit(niimgs, None, sdes)
  
      # 4d niimg as input
      SecondLevelModel().fit(niimg_4d, None, sdes)
  
imports: import os
  from pathlib import Path
  import numpy
  import pandas
  import pytest
  from nibabel import Nifti1Image, load
  from numpy.testing import assert_almost_equal, assert_array_almost_equal, assert_array_equal
  from scipy import stats
  from nilearn._utils import testing
  from nilearn._utils.data_gen import generate_fake_fmri_data_and_design, write_fake_bold_img, write_fake_fmri_data_and_design
  from nilearn.glm.first_level import FirstLevelModel, run_glm
  from nilearn.glm.second_level import SecondLevelModel, non_parametric_inference
  from nilearn.glm.second_level.second_level import _check_confounds, _check_design_matrix, _check_effect_maps, _check_first_level_contrast, _check_input_as_first_level_model, _check_output_type, _check_second_level_input, _infer_effect_maps, _process_second_level_input_as_dataframe, _process_second_level_input_as_firstlevelmodels, _sort_input_dataframe
  from nilearn.image import concat_imgs, get_data, new_img_like, smooth_img
  from nilearn.maskers import NiftiMasker
label_desc: Use image node_id 27 for calling a global function with example usage: test_fmri_inputs(tmp_path, rng, confounds, shape_3d_default, shape_4d_default) without return types