summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stwcs/tests/test_updatewcs.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/stwcs/tests/test_updatewcs.py b/stwcs/tests/test_updatewcs.py
index 218f4f2..c4e58db 100644
--- a/stwcs/tests/test_updatewcs.py
+++ b/stwcs/tests/test_updatewcs.py
@@ -322,11 +322,10 @@ def test_update_d2im_distortion():
d2imerr1 = fits.getval(acs_file, ext=1, keyword='D2IMERR1')
d2imerr4 = fits.getval(acs_file, ext=4, keyword='D2IMERR1')
shutil.copyfile(d2imfile, newd2im)
- newf = fits.open(newd2im, mode='update')
- for ext in newf[1:]:
- ext.data = ext.data * 100
- newf.flush()
- newf.close()
+ with fits.open(newd2im, mode='update') as newf:
+ for ext in newf[1:]:
+ ext.data = ext.data * 100
+
fits.setval(acs_file, keyword="D2IMFILE", value=newd2im)
updatewcs.updatewcs(acs_file)
nd2imerr1 = fits.getval(acs_file, ext=1, keyword='D2IMERR1')