code: def test_convert_nifti_int_fail(tmp_path):
      infile = get_test_data(fname="anatomical.nii")
      outfile = tmp_path / f"output.nii"
  
      orig = nib.load(infile)
      assert not outfile.exists()
  
      with pytest.raises(ValueError):
          convert.main(
              [str(infile), str(outfile), "--out-dtype", "int"]
          )
      assert not outfile.exists()
  
      with pytest.warns(UserWarning):
          convert.main(
              [
                  str(infile),
                  str(outfile),
                  "--out-dtype",
                  "int",
                  "--force",
              ]
          )
      assert outfile.is_file()
  
      converted = nib.load(outfile)
      assert np.allclose(converted.affine, orig.affine)
      assert converted.shape == orig.shape
      # Note: '--force' ignores the error, but can't interpret it enough to do
      # the cast anyway
      assert converted.get_data_dtype() == orig.get_data_dtype()
  
file_path: nibabel/nibabel/cmdline/tests/test_convert.py
imports: import numpy
  import pytest
  import nibabel
  from nibabel.cmdline import convert
  from nibabel.testing import get_test_data
label_desc: Use image node_id 5 for calling a global function with example usage: test_convert_nifti_int_fail(tmp_path) without return types