code: def test_mandatory_outvol(create_files_in_directory):
      filelist, outdir = create_files_in_directory
      mni = freesurfer.MNIBiasCorrection()
  
      # make sure command gets called
      assert mni.cmd == "mri_nu_correct.mni"
  
      # test raising error with mandatory args absent
      with pytest.raises(ValueError):
          mni.cmdline
  
      # test with minimal args
      mni.inputs.in_file = filelist[0]
      base, ext = os.path.splitext(os.path.basename(filelist[0]))
      if ext == ".gz":
          base, ext2 = os.path.splitext(base)
          ext = ext2 + ext
  
      assert mni.cmdline == (
          f"mri_nu_correct.mni --i {filelist[0]} --n 4 --o {base}_output{ext}"
      )
  
      # test with custom outfile
      mni.inputs.out_file = "new_corrected_file.mgz"
      assert mni.cmdline == (
          "mri_nu_correct.mni --i %s --n 4 --o new_corrected_file.mgz"
          % (filelist[0])
      )
  
      # constructor based tests
      mni2 = freesurfer.MNIBiasCorrection(
          in_file=filelist[0],
          out_file="bias_corrected_output",
          iterations=2,
      )
      assert mni2.cmdline == (
          "mri_nu_correct.mni --i %s --n 2 --o bias_corrected_output"
          % filelist[0]
      )
  
file_path: nipype/nipype/interfaces/freesurfer/tests/test_preprocess.py
imports: import os
  import pytest
  from looseversion import LooseVersion
  from nipype.testing.fixtures import create_files_in_directory
  from nipype.interfaces import freesurfer
  from nipype.interfaces.freesurfer import Info
label_desc: Use image node_id 4 for calling a global function with example usage: test_mandatory_outvol(create_files_in_directory) without return types