code: def test_fail_save():
      with InTemporaryDirectory():
          dataobj = np.ones((10, 10, 10), dtype=np.float16)
          affine = np.eye(4, dtype=np.float32)
          img = SpatialImage(dataobj, affine)
          # Fails because float16 is not supported.
          with pytest.raises(AttributeError):
              nils.save(img, "foo.nii.gz")
          del img
  
imports: import logging
  import pathlib
  import shutil
  from io import BytesIO
  from os.path import dirname
  from os.path import join
  from tempfile import mkdtemp
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ..None import AnalyzeImage, MGHImage, Minc1Image, Minc2Image, Nifti1Header, Nifti1Image, Nifti1Pair, Nifti2Image, Nifti2Pair, Spm2AnalyzeImage, Spm99AnalyzeImage, all_image_classes
  from ..None import analyze
  from ..None import loadsave
  from ..None import nifti1
  from ..None import spm2analyze
  from ..None import spm99analyze
  from ..optpkg import optional_package
  from ..spatialimages import SpatialImage
  from ..testing import expires
  from ..tmpdirs import InTemporaryDirectory
  from ..volumeutils import native_code, swapped_code
label_desc: Use image node_id 9 for calling a global function with example usage: test_fail_save() without return types