'According to the FITS standard (section 7.3.2):
If the number of elements in the array implied by the TDIMn is less
than the allocated size of the ar- ray in the FITS file, then the
unused trailing elements should be interpreted as containing
undefined fill values.
*deep sigh* What this means is if a column has a repeat count larger
than the number of elements indicated by its TDIM (ex: TDIM1 = \'(2,2)\',
but TFORM1 = 6I), then instead of this being an outright error we are
to take the first 4 elements as implied by the TDIM and ignore the
additional two trailing elements.'

def test_columns_with_truncating_tdim(self):

    arr1 = [['ab', 'cd'], ['ef', 'gh'], ['ij', 'kl']]
    arr2 = [1, 2, 3, 4, 5]
    arr = np.array([(arr1, arr2), (arr1, arr2)], dtype=[('a', '(3,    2)S2'), ('b', '5i8')])
    tbhdu = fits.BinTableHDU(data=arr)
    tbhdu.writeto(self.temp('test.fits'))
    with open(self.temp('test.fits'), 'rb') as f:
        raw_bytes = f.read()
    with open(self.temp('test.fits'), 'wb') as f:
        f.write(raw_bytes.replace('(2,2,3)', '(2,2,2)'))
    with fits.open(self.temp('test.fits')) as hdul:
        tbhdu2 = hdul[1]
        assert (tbhdu2.header['TDIM1'] == '(2,2,2)')
        assert (tbhdu2.header['TFORM1'] == '12A')
        for row in tbhdu2.data:
            assert np.all((row['a'] == [['ab', 'cd'], ['ef', 'gh']]))
            assert np.all((row['b'] == [1, 2, 3, 4, 5]))
