'Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/148 where
checksums are being removed from headers when a file is opened in
update mode, even though no changes were made to the file.'

def test_open_update_mode_preserve_checksum(self):

    self.copy_file('checksum.fits')
    with fits.open(self.temp('checksum.fits')) as hdul:
        data = hdul[1].data.copy()
    hdul = fits.open(self.temp('checksum.fits'), mode='update')
    hdul.close()
    with fits.open(self.temp('checksum.fits')) as hdul:
        assert ('CHECKSUM' in hdul[1].header)
        assert ('DATASUM' in hdul[1].header)
        assert comparerecords(data, hdul[1].data)
