'Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/88 2
Identical to test_open_scaled_in_update_mode() but with a compressed
version of the scaled image.'

def test_open_scaled_in_update_mode_compressed(self):

    with fits.open(self.data('scale.fits'), do_not_scale_image_data=True) as hdul:
        chdu = fits.CompImageHDU(data=hdul[0].data, header=hdul[0].header)
        chdu.writeto(self.temp('scale.fits'))
    mtime = os.stat(self.temp('scale.fits')).st_mtime
    time.sleep(1)
    fits.open(self.temp('scale.fits'), mode='update').close()
    assert (mtime == os.stat(self.temp('scale.fits')).st_mtime)
    time.sleep(1)
    hdul = fits.open(self.temp('scale.fits'), 'update')
    hdul[1].data
    hdul.close()
    assert (mtime != os.stat(self.temp('scale.fits')).st_mtime)
    hdul = fits.open(self.temp('scale.fits'), mode='update')
    assert (hdul[1].data.dtype == np.dtype('float32'))
    assert (hdul[1].header['BITPIX'] == (-32))
    assert ('BZERO' not in hdul[1].header)
    assert ('BSCALE' not in hdul[1].header)
    hdul[1].data.shape = (42, 10)
    hdul.close()
    hdul = fits.open(self.temp('scale.fits'))
    assert (hdul[1].shape == (42, 10))
    assert (hdul[1].data.dtype == np.dtype('float32'))
    assert (hdul[1].header['BITPIX'] == (-32))
    assert ('BZERO' not in hdul[1].header)
    assert ('BSCALE' not in hdul[1].header)
