'Tests that new extension HDUs that are added to an HDUList can be
properly indexed by their EXTNAME/EXTVER (regression test for
ticket:48).'

def test_new_hdu_extname(self):

    f = fits.open(self.data('test0.fits'))
    hdul = fits.HDUList()
    hdul.append(f[0].copy())
    hdul.append(fits.ImageHDU(header=f[1].header))
    assert (hdul[1].header['EXTNAME'] == 'SCI')
    assert (hdul[1].header['EXTVER'] == 1)
    assert (hdul.index_of(('SCI', 1)) == 1)
