'Tests two ways of creating a new `BinTableHDU` from a column of
string arrays.
This tests for a couple different regressions, and ensures that
both BinTableHDU(data=arr) and BinTableHDU.from_columns(arr) work
equivalently.
Some of this is redundant with the following test, but checks some
subtly different cases.'

def test_bin_table_init_from_string_array_column(self):

    data = [['abcd', 'efgh'], ['ijkl', 'mnop'], ['qrst', 'uvwx']]
    arr = np.array([(data,), (data,), (data,), (data,), (data,)], dtype=[('S', '(3,    2)S4')])
    with catch_warnings() as w:
        tbhdu1 = fits.BinTableHDU(data=arr)
    assert (len(w) == 0)
    def test_dims_and_roundtrip(tbhdu):
        assert (tbhdu.data['S'].shape == (5, 3, 2))
        if six.PY2:
            assert tbhdu.data['S'].dtype.str.endswith('S4')
        else:
            assert tbhdu.data['S'].dtype.str.endswith('U4')
        tbhdu.writeto(self.temp('test.fits'), overwrite=True)
        with fits.open(self.temp('test.fits')) as hdul:
            tbhdu2 = hdul[1]
            assert (tbhdu2.header['TDIM1'] == '(4,2,3)')
            assert (tbhdu2.data['S'].shape == (5, 3, 2))
            if six.PY2:
                assert tbhdu.data['S'].dtype.str.endswith('S4')
            else:
                assert tbhdu.data['S'].dtype.str.endswith('U4')
            assert np.all((tbhdu2.data['S'] == tbhdu.data['S']))
    test_dims_and_roundtrip(tbhdu1)
    tbhdu2 = fits.BinTableHDU.from_columns(arr)
    test_dims_and_roundtrip(tbhdu2)
