'Test for https://github.com/astropy/astropy/pull/4080, demonstrating
that FITS tables are converted to native byte order.'

def test_byteswap_fits_array(self, table_types):

    non_native_order = ('>', '<')[(sys.byteorder != 'little')]
    filename = get_pkg_data_filename('data/tb.fits', 'astropy.io.fits.tests')
    t = table_types.Table.read(filename)
    arr = t.as_array()
    for idx in range(len(arr.dtype)):
        assert (arr.dtype[idx].byteorder != non_native_order)
    with fits.open(filename) as hdul:
        data = hdul[1].data
        for colname in data.columns.names:
            assert np.all((data[colname] == arr[colname]))
        arr2 = t.as_array(keep_byteorder=True)
        for colname in data.columns.names:
            assert (data[colname].dtype.byteorder == arr2[colname].dtype.byteorder)
