'Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/88 1
Identical to test_rewriting_large_scaled_image() but with a compressed
image.'

def test_rewriting_large_scaled_image_compressed(self):

    with fits.open(self.data('fixed-1890.fits'), do_not_scale_image_data=True) as hdul:
        chdu = fits.CompImageHDU(data=hdul[0].data, header=hdul[0].header)
        chdu.writeto(self.temp('fixed-1890-z.fits'))
    hdul = fits.open(self.temp('fixed-1890-z.fits'))
    orig_data = hdul[1].data
    with ignore_warnings():
        hdul.writeto(self.temp('test_new.fits'), overwrite=True)
    hdul.close()
    hdul = fits.open(self.temp('test_new.fits'))
    assert (hdul[1].data == orig_data).all()
    hdul.close()
    hdul = fits.open(self.temp('fixed-1890-z.fits'))
    with ignore_warnings():
        hdul.writeto(self.temp('test_new.fits'), overwrite=True)
    hdul.close()
    hdul = fits.open(self.temp('test_new.fits'))
    assert (hdul[1].data == orig_data).all()
    hdul.close()
    hdul = fits.open(self.temp('fixed-1890-z.fits'), do_not_scale_image_data=True)
    hdul.writeto(self.temp('test_new.fits'), overwrite=True, output_verify='silentfix')
    hdul.close()
    hdul = fits.open(self.temp('test_new.fits'))
    orig_data = hdul[1].data
    hdul.close()
    hdul = fits.open(self.temp('test_new.fits'), mode='update')
    hdul.close()
    hdul = fits.open(self.temp('test_new.fits'))
    assert (hdul[1].data == orig_data).all()
    hdul = fits.open(self.temp('test_new.fits'))
    hdul.close()
