'When creating a table column with non-trivial TDIMn, and
big-endian array data read from an existing FITS file, the data
should not be unnecessarily byteswapped.
Regression test for https://github.com/astropy/astropy/issues/3561'

def test_dim_column_byte_order_mismatch(self):

    data = fits.getdata(self.data('random_groups.fits'))['DATA']
    col = fits.Column(name='TEST', array=data, dim='(3,1,128,1,1)', format='1152E')
    thdu = fits.BinTableHDU.from_columns([col])
    thdu.writeto(self.temp('test.fits'))
    with fits.open(self.temp('test.fits')) as hdul:
        assert np.all((hdul[1].data['TEST'] == data))
