'Test extending header with and without unique=True and commentary
cards in the header being added.
Though not quite the same as astropy/astropy#3967, update=True hits
the same if statement as that issue.'

def test_header_extend_update_commentary(self):

    for commentary_card in ['', 'COMMENT', 'HISTORY']:
        for is_update in [True, False]:
            hdu = fits.PrimaryHDU()
            assert (commentary_card not in hdu.header)
            hdu2 = fits.ImageHDU()
            hdu2.header[commentary_card] = 'My    text'
            hdu.header.extend(hdu2.header, update=is_update)
            assert (len(hdu.header) == 5)
            assert (hdu.header[commentary_card][0] == 'My    text')
