'Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/197'

def test_missing_tnull(self):

    c = fits.Column('F1', 'A3', null='---', array=np.array(['1.0', '2.0', '---', '3.0']), ascii=True)
    table = fits.TableHDU.from_columns([c])
    table.writeto(self.temp('test.fits'))
    with fits.open(self.temp('test.fits'), mode='update') as h:
        h[1].header['TFORM1'] = 'E3'
        del h[1].header['TNULL1']
    with fits.open(self.temp('test.fits')) as h:
        pytest.raises(ValueError, (lambda : h[1].data['F1']))
    try:
        with fits.open(self.temp('test.fits')) as h:
            h[1].data['F1']
    except ValueError as e:
        assert str(e).endswith('the    header    may    be    missing    the    necessary    TNULL1    keyword    or    the    table    contains    invalid    data')
