code: def test_data_default(self):
      # check that the default dtype comes from the data if the header
      # is None, and that unsupported dtypes raise an error
      img_klass = self.image_class
      hdr_klass = self.image_class.header_class
      data = np.arange(24, dtype=np.int32).reshape((2, 3, 4))
      affine = np.eye(4)
      img = img_klass(data, affine)
      self.check_dtypes(data.dtype, img.get_data_dtype())
      header = hdr_klass()
      header.set_data_dtype(np.float32)
      img = img_klass(data, affine, header)
      self.check_dtypes(np.dtype(np.float32), img.get_data_dtype())
  
imports: from io import BytesIO
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  from ..None import load
  from ..imageclasses import spatial_axes_first
  from ..spatialimages import HeaderDataError, SpatialHeader, SpatialImage
  from ..testing import bytesio_round_trip, expires, memmap_after_ufunc
  from ..tmpdirs import InTemporaryDirectory
label_desc: Use image node_id 7 for calling the TestSpatialImage obj's underlying member method code with example usage: obj.test_data_default() without return types