code: def test_shapes(self):
      # Test that shape checks work
      hdr = self.header_class()
      for shape in ((2, 3, 4), (2, 3, 4, 5), (2, 3), (2,)):
          hdr.set_data_shape(shape)
          assert hdr.get_data_shape() == shape
      # Check max works, but max+1 raises error
      dim_dtype = hdr.structarr["dim"].dtype
      mx = int(np.iinfo(dim_dtype).max)
      shape = (mx,)
      hdr.set_data_shape(shape)
      assert hdr.get_data_shape() == shape
      shape = (mx + 1,)
      with pytest.raises(HeaderDataError):
          hdr.set_data_shape(shape)
      # Lists or tuples or arrays will work for setting shape
      shape = (2, 3, 4)
      for constructor in (list, tuple, np.array):
          hdr.set_data_shape(constructor(shape))
          assert hdr.get_data_shape() == shape
  
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 14 for calling the TestAnalyzeHeader obj's underlying member method code with example usage: obj.test_shapes() without return types