'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.
This is like the test of the same name in test_image, but tests this
for tables as well.'

def test_constructor_copies_header(self):

    ifd = fits.HDUList([fits.PrimaryHDU(), fits.BinTableHDU()])
    thdr = ifd[1].header
    thdr['FILENAME'] = 'labq01i3q_rawtag.fits'
    thdu = fits.BinTableHDU(header=thdr)
    ofd = fits.HDUList(thdu)
    ofd[0].header['FILENAME'] = 'labq01i3q_flt.fits'
    assert (thdr['FILENAME'] == 'labq01i3q_rawtag.fits')
