code: def test_bytes(self):
      # Test get of bytes
      hdr1 = self.header_class()
      bb = hdr1.binaryblock
      hdr2 = self.header_class(hdr1.binaryblock)
      assert hdr1 == hdr2
      assert hdr1.binaryblock == hdr2.binaryblock
      # Do a set into the header, and try again.  The specifics of 'setting
      # something' will depend on the nature of the bytes object
      self._set_something_into_hdr(hdr1)
      hdr2 = self.header_class(hdr1.binaryblock)
      assert hdr1 == hdr2
      assert hdr1.binaryblock == hdr2.binaryblock
      # Short binaryblocks give errors (here set through init)
      # Long binaryblocks are truncated
      with pytest.raises(WrapStructError):
          self.header_class(
              bb[: self.header_class._hdrdtype.itemsize - 1]
          )
  
      # Checking set to true by default, and prevents nonsense being
      # set into the header.
      bb_bad = self.get_bad_bb()
      if bb_bad is None:
          return
      with imageglobals.LoggingOutputSuppressor():
          with pytest.raises(HeaderDataError):
              self.header_class(bb_bad)
  
      # now slips past without check
      _ = self.header_class(bb_bad, check=False)
  
imports: import io
  import os
  import pathlib
  import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_almost_equal, assert_array_equal
  from ...None import imageglobals
  from ...fileholders import FileHolder
  from ...openers import ImageOpener
  from ...spatialimages import HeaderDataError
  from ...testing import data_path
  from ...tests import test_spatialimages
  from ...tests import test_wrapstruct
  from ...tmpdirs import InTemporaryDirectory
  from ...volumeutils import sys_is_le
  from ...wrapstruct import WrapStructError
  from ..None import load, save
  from ..mghformat import MGHError, MGHHeader, MGHImage
label_desc: Use image node_id 7 for calling the TestMGHHeader obj's underlying member method code with example usage: obj.test_bytes() without return types