'Ensure that setting reserved keywords related to the table data
structure on CompImageHDU image headers fails.'

def test_compression_update_header_with_reserved(self):

    def test_set_keyword(hdr, keyword, value):
        with catch_warnings() as w:
            hdr[keyword] = value
            assert (len(w) == 1)
            assert str(w[0].message).startswith('Keyword    {!r}    is    reserved'.format(keyword))
            assert (keyword not in hdr)
    with fits.open(self.data('comp.fits')) as hdul:
        hdr = hdul[1].header
        test_set_keyword(hdr, 'TFIELDS', 8)
        test_set_keyword(hdr, 'TTYPE1', 'Foo')
        test_set_keyword(hdr, 'ZCMPTYPE', 'ASDF')
        test_set_keyword(hdr, 'ZVAL1', 'Foo')
