code: def test_to_from_fileobj(self):
      # Successful write using write_to
      hdr = self.header_class()
      str_io = io.BytesIO()
      hdr.write_to(str_io)
      str_io.seek(0)
      hdr2 = self.header_class.from_fileobj(str_io)
      assert hdr2.endianness == ">"
      assert hdr2.binaryblock == hdr.binaryblock
  
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 5 for calling the TestMGHHeader obj's underlying member method code with example usage: obj.test_to_from_fileobj() without return types