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

def test_extend_variable_length_array(self):

    def test(format_code):
        arr = ([([1] * 10)] * 10)
        col1 = fits.Column(name='TESTVLF', format=format_code, array=arr)
        col2 = fits.Column(name='TESTSCA', format='J', array=([1] * 10))
        tb_hdu = fits.BinTableHDU.from_columns([col1, col2], nrows=15)
        assert (len(tb_hdu.data['TESTSCA']) == 15)
        assert (len(tb_hdu.data['TESTVLF']) == 15)
        assert (tb_hdu.data['TESTVLF'][0] == arr[0]).all()
        assert (tb_hdu.data['TESTVLF'][9] == arr[9]).all()
        assert (tb_hdu.data['TESTVLF'][10] == ([0] * 10)).all()
        assert (tb_hdu.data['TESTVLF'][(-1)] == ([0] * 10)).all()
    for code in ('PJ()', 'QJ()'):
        test(code)
