code: def test_header_copy():
      # Test header copying
      hdr = PARRECHeader(HDR_INFO, HDR_DEFS)
      hdr2 = hdr.copy()
  
      def assert_copy_ok(hdr1, hdr2):
          assert hdr1 is not hdr2
          assert hdr1.permit_truncated == hdr2.permit_truncated
          assert hdr1.general_info is not hdr2.general_info
          assert_arr_dict_equal(hdr1.general_info, hdr2.general_info)
          assert hdr1.image_defs is not hdr2.image_defs
          assert_structarr_equal(hdr1.image_defs, hdr2.image_defs)
  
      assert_copy_ok(hdr, hdr2)
      assert not hdr.permit_truncated
      assert not hdr2.permit_truncated
      with open(TRUNC_PAR) as fobj:
          with pytest.raises(PARRECError):
              PARRECHeader.from_fileobj(fobj)
      with open(TRUNC_PAR) as fobj:
          # Parse but warn on inconsistent header
          with pytest.warns(UserWarning, match="Header inconsistency"):
              trunc_hdr = PARRECHeader.from_fileobj(fobj, True)
      assert trunc_hdr.permit_truncated
      # Warn on inconsistent header when copying
      with pytest.warns(UserWarning, match="Header inconsistency"):
          trunc_hdr2 = trunc_hdr.copy()
      assert_copy_ok(trunc_hdr, trunc_hdr2)
  
imports: from glob import glob
  from os.path import basename, dirname
  from os.path import join
  from warnings import simplefilter
  import numpy
  import pytest
  from numpy import array
  from numpy.testing import assert_almost_equal, assert_array_equal
  from ..None import load
  from ..None import parrec
  from ..fileholders import FileHolder
  from ..nifti1 import Nifti1Extension, Nifti1Header, Nifti1Image
  from ..openers import ImageOpener
  from ..parrec import PARRECArrayProxy, PARRECError, PARRECHeader, PARRECImage, exts2pars, parse_PAR_header, vol_is_full, vol_numbers
  from ..testing import assert_arr_dict_equal, clear_and_catch_warnings, suppress_warnings
  from ..volumeutils import array_from_file
  from .None import test_spatialimages
  from .test_arrayproxy import check_mmap
label_desc: Use image node_id 28 for calling a global function with example usage: test_header_copy() without return types