code: def test_shape_zooms():
      hdr = SpatialHeader()
      hdr.set_data_shape((1, 2, 3))
      assert hdr.get_data_shape() == (1, 2, 3)
      assert hdr.get_zooms() == (1.0, 1.0, 1.0)
      hdr.set_zooms((4, 3, 2))
      assert hdr.get_zooms() == (4.0, 3.0, 2.0)
      hdr.set_data_shape((1, 2))
      assert hdr.get_data_shape() == (1, 2)
      assert hdr.get_zooms() == (4.0, 3.0)
      hdr.set_data_shape((1, 2, 3))
      assert hdr.get_data_shape() == (1, 2, 3)
      assert hdr.get_zooms() == (4.0, 3.0, 1.0)
      # null shape is (0,)
      hdr.set_data_shape(())
      assert hdr.get_data_shape() == (0,)
      assert hdr.get_zooms() == (1.0,)
      # zooms of wrong lengths raise error
      with pytest.raises(HeaderDataError):
          hdr.set_zooms((4.0, 3.0))
      with pytest.raises(HeaderDataError):
          hdr.set_zooms((4.0, 3.0, 2.0, 1.0))
      # as do negative zooms
      with pytest.raises(HeaderDataError):
          hdr.set_zooms((4.0, 3.0, -2.0))
  
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 5 for calling a global function with example usage: test_shape_zooms() without return types