'Like test_array_slicing but with the file opened in \'readonly\' mode.
Regression test for a crash when slicing readonly memmap\'d tables.'

def test_array_slicing_readonly(self):

    f = fits.open(self.data('table.fits'), mode='readonly')
    data = f[1].data
    s1 = data[(data['target'] == 'NGC1001')]
    s2 = data[np.where((data['target'] == 'NGC1001'))]
    s3 = data[[0]]
    s4 = data[:1]
    for s in [s1, s2, s3, s4]:
        assert isinstance(s, fits.FITS_rec)
    assert comparerecords(s1, s2)
    assert comparerecords(s2, s3)
    assert comparerecords(s3, s4)
