@@ -372,14 +372,14 @@ def test_scale_back_compressed(self):
372372 assert (hdul [1 ].data [0 ] == zero_point ).all ()
373373
374374 with fits .open (self .temp ("scale.fits" )) as hdul :
375- assert (hdul [1 ].data [1 :] == orig_data [1 :]). all ( )
375+ assert_equal (hdul [1 ].data [1 :], orig_data [1 :])
376376 # Extra test to ensure that after everything the data is still the
377377 # same as in the original uncompressed version of the image
378378 with fits .open (self .data ("scale.fits" )) as hdul2 :
379379 # Recall we made the same modification to the data in hdul
380380 # above
381381 hdul2 [0 ].data [0 ] = 0
382- assert (hdul [1 ].data == hdul2 [0 ].data ). all ( )
382+ assert_equal (hdul [1 ].data , hdul2 [0 ].data )
383383
384384 def test_lossless_gzip_compression (self ):
385385 """Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/198"""
@@ -982,6 +982,17 @@ def test_shape(self):
982982 assert hdul [1 ].header ["NAXIS2" ] == 120
983983 assert hdul [1 ].shape == (120 , 150 )
984984
985+ def test_inplace_data_modify (self , tmp_path ):
986+
987+ self .copy_file ("comp.fits" )
988+
989+ with fits .open (self .temp ('comp.fits' ), mode = "update" ) as hdul :
990+ data = hdul [1 ].data
991+ data [0 ] = 0
992+
993+ with fits .open (self .temp ('comp.fits' )) as hdul :
994+ assert hdul [1 ].data [0 , 0 ] == 0
995+
985996
986997class TestCompHDUSections :
987998 @pytest .fixture (autouse = True )
@@ -1004,6 +1015,7 @@ def setup_method(self, tmp_path):
10041015 hdulist .writeto (tmp_path / "sections.fits" )
10051016
10061017 self .hdul = fits .open (tmp_path / "sections.fits" )
1018+ self .hdul2 = fits .open (tmp_path / "sections.fits" )
10071019
10081020 def teardown_method (self ):
10091021 self .hdul .close ()
0 commit comments