code: def test_binarymaths(create_files_in_directory_plus_output_type):
      (
          files,
          testdir,
          out_ext,
      ) = create_files_in_directory_plus_output_type
  
      # Get the command
      maths = fsl.BinaryMaths(in_file="a.nii", out_file="c.nii")
  
      # Test the underlying command
      assert maths.cmd == "fslmaths"
  
      # Test that it fails without an operation an
      with pytest.raises(ValueError):
          maths.run()
  
      # Test the different operations
      ops = ["add", "sub", "mul", "div", "rem", "min", "max"]
      operands = ["b.nii", -2, -0.5, 0, 0.123456, np.pi, 500]
      for op in ops:
          for ent in operands:
              maths = fsl.BinaryMaths(
                  in_file="a.nii", out_file="c.nii", operation=op
              )
              if ent == "b.nii":
                  maths.inputs.operand_file = ent
                  assert (
                      maths.cmdline
                      == f"fslmaths a.nii -{op} b.nii c.nii"
                  )
              else:
                  maths.inputs.operand_value = ent
                  assert (
                      maths.cmdline
                      == "fslmaths a.nii -{} {:.8f} c.nii".format(
                          op, ent
                      )
                  )
  
      # Test that we don't need to ask for an out file
      for op in ops:
          maths = fsl.BinaryMaths(
              in_file="a.nii", operation=op, operand_file="b.nii"
          )
          assert maths.cmdline == "fslmaths a.nii -{} b.nii {}".format(
              op, os.path.join(testdir, f"a_maths{out_ext}")
          )
  
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 13 for calling a global function with example usage: test_binarymaths(create_files_in_directory_plus_output_type) without return types