summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadia Dencheva <nadia.dencheva@gmail.com>2016-12-18 15:33:15 -0500
committerNadia Dencheva <nadia.dencheva@gmail.com>2016-12-18 15:33:15 -0500
commit61a9c34dabee4cfad1c2e97cbee1cba5be7331e4 (patch)
tree39146f20c15acd3cd883b1051a5c65a7b84f8a38
parent68255f10fccc6171658f31b1550290f4f4d59a28 (diff)
downloadstwcs_hcf-61a9c34dabee4cfad1c2e97cbee1cba5be7331e4.tar.gz
use with - cm
-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')