code: def test_data_shape(self):
      # Check shape correctly read
      img_klass = self.image_class
      # Assumes all possible images support int16
      # See https://github.com/nipy/nibabel/issues/58
      arr = np.arange(4, dtype=np.int16)
      img = img_klass(arr, np.eye(4))
      # Shape may be promoted to higher dimension, but may not reorder or
      # change size
      assert img.shape[:1] == (4,)
      assert np.prod(img.shape) == 4
      img = img_klass(np.zeros((2, 3, 4), dtype=np.float32), np.eye(4))
      assert img.shape == (2, 3, 4)
  
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 8 for calling the TestSpatialImage obj's underlying member method code with example usage: obj.test_data_shape() without return types