'Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/153
Ensure that a header from one HDU is copied when used to initialize new
HDU.'

def test_constructor_copies_header(self):

    ifd = fits.HDUList(fits.PrimaryHDU())
    phdr = ifd[0].header
    phdr['FILENAME'] = 'labq01i3q_rawtag.fits'
    primary_hdu = fits.PrimaryHDU(header=phdr)
    ofd = fits.HDUList(primary_hdu)
    ofd[0].header['FILENAME'] = 'labq01i3q_flt.fits'
    assert (phdr['FILENAME'] == 'labq01i3q_rawtag.fits')
