#NEWLINE# def test_updated_file_permissions( self ) : #NEWLINE# #INDENT# '\n        Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/79\n\n        Tests that when a FITS file is modified in update mode, the file\n        permissions are preserved.\n        ' #NEWLINE# filename = self . temp ( 'test.fits' ) #NEWLINE# hdul = [ fits . PrimaryHDU ( ) , fits . ImageHDU ( ) ] #NEWLINE# hdul = fits . HDUList ( hdul ) #NEWLINE# hdul . writeto ( hdul ) #NEWLINE# old_mode = os . stat ( filename ) . st_mode #NEWLINE# hdul = fits . open ( filename , mode = 'update' ) #NEWLINE# hdul . insert ( 1 , fits . ImageHDU ( ) ) #NEWLINE# hdul . flush ( ) #NEWLINE# hdul . close ( ) #NEWLINE# assert ( old_mode == os . stat ( filename ) . st_mode )