'Regression test for
https://github.com/spacetelescope/PyFITS/issues/25
Replacing the mmap\'d data of one file with mmap\'d data from a
different file should work.  Like test_replace_mmap_data but with
table data instead of image data.'

def test_replace_mmap_data_2(self):

    arr_a = np.arange(10)
    arr_b = (arr_a * 2)
    def test(mmap_a, mmap_b):
        col_a = fits.Column(name='a', format='J', array=arr_a)
        col_b = fits.Column(name='b', format='J', array=arr_b)
        hdu_a = fits.BinTableHDU.from_columns([col_a])
        hdu_a.writeto(self.temp('test_a.fits'), overwrite=True)
        hdu_b = fits.BinTableHDU.from_columns([col_b])
        hdu_b.writeto(self.temp('test_b.fits'), overwrite=True)
        hdul_a = fits.open(self.temp('test_a.fits'), mode='update', memmap=mmap_a)
        hdul_b = fits.open(self.temp('test_b.fits'), memmap=mmap_b)
        hdul_a[1].data = hdul_b[1].data
        hdul_a.close()
        hdul_b.close()
        hdul_a = fits.open(self.temp('test_a.fits'))
        assert ('b' in hdul_a[1].columns.names)
        assert ('a' not in hdul_a[1].columns.names)
        assert np.all((hdul_a[1].data['b'] == arr_b))
    with ignore_warnings():
        test(True, True)
        test(False, True)
        test(True, False)
