code: def test_swapdims(create_files_in_directory_plus_output_type):
      (
          files,
          testdir,
          out_ext,
      ) = create_files_in_directory_plus_output_type
      swap = fsl.SwapDimensions()
  
      # Test the underlying command
      assert swap.cmd == "fslswapdim"
  
      # Test mandatory args
      args = [dict(in_file=files[0]), dict(new_dims=("x", "y", "z"))]
      for arg in args:
          wontrun = fsl.SwapDimensions(**arg)
          with pytest.raises(ValueError):
              wontrun.run()
  
      # Now test a basic command line
      swap.inputs.in_file = files[0]
      swap.inputs.new_dims = ("x", "y", "z")
      assert (
          swap.cmdline
          == "fslswapdim a.nii x y z %s"
          % os.path.realpath(
              os.path.join(testdir, "a_newdims%s" % out_ext)
          )
      )
  
      # Test that we can set an output name
      swap.inputs.out_file = "b.nii"
      assert swap.cmdline == "fslswapdim a.nii x y z b.nii"
  
file_path: nipype/nipype/interfaces/fsl/tests/test_utils.py
imports: import os
  import numpy
  import nibabel
  import pytest
  import nipype.interfaces.fsl.utils
  from nipype.interfaces.fsl import no_fsl, Info
  from nipype.testing.fixtures import create_files_in_directory_plus_output_type
label_desc: Use image node_id 10 for calling a global function with example usage: test_swapdims(create_files_in_directory_plus_output_type) without return types