'Tests inserting a Simple Image ExtensionHDU to a non-empty HDUList
as the primary HDU.'

def test_insert_image_extension_to_primary_in_non_empty_list(self):

    hdul = fits.open(self.data('tb.fits'))
    hdu = fits.ImageHDU(np.arange(100, dtype=np.int32))
    hdul.insert(0, hdu)
    info = [(0, 'PRIMARY', 1, 'PrimaryHDU', 5, (100,), 'int32', ''), (1, '', 1, 'ImageHDU', 12, (), '', ''), (2, '', 1, 'BinTableHDU', 24, '2R    x    4C', '[1J,    3A,    1E,    1L]', '')]
    assert (hdul.info(output=False) == info)
    hdul.writeto(self.temp('test-insert.fits'))
    assert (fits.info(self.temp('test-insert.fits'), output=False) == info)
