Skip to content

Commit

Permalink
try using context manager to avoid "unclosed file" error
Browse files Browse the repository at this point in the history
  • Loading branch information
keflavich authored and bsipocz committed Nov 4, 2022
1 parent cb67fcd commit 562aa90
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions astroquery/desi/tests/test_desi.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def compare_result_data(result, data):

def image_tester(images, filetype):
assert type(images) == list
data = fits.open(data_path(DATA_FILES[filetype]))
assert images[0][0].header == data[0].header
assert np.array_equal(images[0][0].data, data[0].data)
with fits.open(data_path(DATA_FILES[filetype])) as data:
assert images[0][0].header == data[0].header
assert np.array_equal(images[0][0].data, data[0].data)


def test_coords_query_region(patch_tap, coords=coords, radius=radius):
Expand Down

0 comments on commit 562aa90

Please sign in to comment.