code: def test_no_finite_values(self):
      # save of data with no finite values to int type raises error if we have
      # no scaling
      data = np.zeros((2, 3, 4))
      data[:, 0] = np.nan
      data[:, 1] = np.inf
      data[:, 2] = -np.inf
      img = self.image_class(data, None)
      img.set_data_dtype(np.int16)
      assert img.get_data_dtype() == np.dtype(np.int16)
      fm = bytesio_filemap(img)
      if not img.header.has_data_slope:
          with pytest.raises(WriterError):
              img.to_file_map(fm)
          return
      img.to_file_map(fm)
      img_back = self.image_class.from_file_map(fm)
      assert_array_equal(img_back.dataobj, 0)
  
imports: import itertools
  import logging
  import os
  import pickle
  import re
  from io import BytesIO, StringIO
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ..None import imageglobals
  from ..analyze import AnalyzeHeader, AnalyzeImage
  from ..arraywriters import WriterError
  from ..casting import sctypes_aliases
  from ..nifti1 import Nifti1Header
  from ..optpkg import optional_package
  from ..spatialimages import HeaderDataError, HeaderTypeError, supported_np_types
  from ..testing import assert_dt_equal, bytesio_filemap, bytesio_round_trip, data_path, suppress_warnings
  from ..tmpdirs import InTemporaryDirectory
  from .None import test_spatialimages
  from .None import test_wrapstruct
label_desc: Use image node_id 10 for calling the TestAnalyzeImage obj's underlying member method code with example usage: obj.test_no_finite_values() without return types