code: def test_changedt(create_files_in_directory_plus_output_type):
      (
          files,
          testdir,
          out_ext,
      ) = create_files_in_directory_plus_output_type
  
      # Get some fslmaths
      cdt = fsl.ChangeDataType()
  
      # Test that we got what we wanted
      assert cdt.cmd == "fslmaths"
  
      # Test that it needs a mandatory argument
      with pytest.raises(ValueError):
          cdt.run()
  
      # Set an in file and out file
      cdt.inputs.in_file = "a.nii"
      cdt.inputs.out_file = "b.nii"
  
      # But it still shouldn't work
      with pytest.raises(ValueError):
          cdt.run()
  
      # Now test that we can set the various data types
      dtypes = ["float", "char", "int", "short", "double", "input"]
      cmdline = "fslmaths a.nii b.nii -odt {}"
      for dtype in dtypes:
          foo = fsl.MathsCommand(
              in_file="a.nii", out_file="b.nii", output_datatype=dtype
          )
          assert foo.cmdline == cmdline.format(dtype)
  
imports: import os
  import numpy
  from nipype.interfaces.base import Undefined
  import nipype.interfaces.fsl.maths
  from nipype.interfaces.fsl import no_fsl
  import pytest
  from nipype.testing.fixtures import create_files_in_directory_plus_output_type
label_desc: Use image node_id 2 for calling a global function with example usage: test_changedt(create_files_in_directory_plus_output_type) without return types