Skip to content

Commit 7419d9a

Browse files
committed
style
1 parent 842f2da commit 7419d9a

File tree

2 files changed

+13
-33
lines changed

2 files changed

+13
-33
lines changed

astroquery/esa/hsa/core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def download_data(self, *, retrieval_type="OBSERVATION", observation_id=None,
115115

116116
_, res_params = cgi.parse_header(response.headers['Content-Disposition'])
117117

118-
119118
r_filename = res_params["filename"]
120119
suffixes = Path(r_filename).suffixes
121120

astroquery/esa/hsa/tests/test_hsa_remote.py

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def access_archive_with_retries(self, f, params):
2727
pass
2828
return None
2929

30-
3130
def test_download_data_observation_pacs(self):
3231
obs_id = "1342191813"
3332
parameters = {'retrieval_type': "OBSERVATION",
@@ -38,16 +37,13 @@ def test_download_data_observation_pacs(self):
3837
'download_dir': self.tmp_dir.name}
3938
expected_res = os.path.join(self.tmp_dir.name, obs_id + ".tar")
4039
hsa = HSAClass()
41-
#res = hsa.download_data(**parameters)
4240
res = self.access_archive_with_retries(hsa.download_data, parameters)
43-
if res == None:
41+
if res is None:
4442
pytest.skip("Archive broke the connection {} times, unable to test".format(self.retries))
4543
assert res == expected_res
4644
assert os.path.isfile(res)
47-
chksum = []
4845
tar = tarfile.open(res)
49-
for m in tar.getmembers():
50-
chksum.append(m.chksum)
46+
chksum = [m.chksum for m in tar.getmembers()]
5147
assert chksum.sort() == pacs_chksum.sort()
5248
os.remove(res)
5349

@@ -63,16 +59,13 @@ def test_download_data_observation_pacs_filename(self):
6359
'download_dir': self.tmp_dir.name}
6460
expected_res = os.path.join(self.tmp_dir.name, fname + ".tar")
6561
hsa = HSAClass()
66-
#res = hsa.download_data(**parameters)
6762
res = self.access_archive_with_retries(hsa.download_data, parameters)
68-
if res == None:
63+
if res is None:
6964
pytest.skip("Archive broke the connection {} times, unable to test".format(self.retries))
7065
assert res == expected_res
7166
assert os.path.isfile(res)
72-
chksum = []
7367
tar = tarfile.open(res)
74-
for m in tar.getmembers():
75-
chksum.append(m.chksum)
68+
chksum = [m.chksum for m in tar.getmembers()]
7669
assert chksum.sort() == pacs_chksum.sort()
7770
os.remove(res)
7871

@@ -87,16 +80,13 @@ def test_download_data_observation_pacs_compressed(self):
8780
'download_dir': self.tmp_dir.name}
8881
expected_res = os.path.join(self.tmp_dir.name, obs_id + ".tgz")
8982
hsa = HSAClass()
90-
#res = hsa.download_data(**parameters)
9183
res = self.access_archive_with_retries(hsa.download_data, parameters)
92-
if res == None:
84+
if res is None:
9385
pytest.skip("Archive broke the connection {} times, unable to test".format(self.retries))
9486
assert res == expected_res
9587
assert os.path.isfile(res)
96-
chksum = []
9788
tar = tarfile.open(res)
98-
for m in tar.getmembers():
99-
chksum.append(m.chksum)
89+
chksum = [m.chksum for m in tar.getmembers()]
10090
assert chksum.sort() == pacs_chksum.sort()
10191
os.remove(res)
10292

@@ -110,16 +100,13 @@ def test_download_data_observation_spire(self):
110100
'download_dir': self.tmp_dir.name}
111101
expected_res = os.path.join(self.tmp_dir.name, obs_id + ".tar")
112102
hsa = HSAClass()
113-
#res = hsa.download_data(**parameters)
114103
res = self.access_archive_with_retries(hsa.download_data, parameters)
115-
if res == None:
104+
if res is None:
116105
pytest.skip("Archive broke the connection {} times, unable to test".format(self.retries))
117106
assert res == expected_res
118107
assert os.path.isfile(res)
119-
chksum = []
120108
tar = tarfile.open(res)
121-
for m in tar.getmembers():
122-
chksum.append(m.chksum)
109+
chksum = [m.chksum for m in tar.getmembers()]
123110
assert chksum.sort() == spire_chksum.sort()
124111
os.remove(res)
125112

@@ -132,9 +119,8 @@ def test_download_data_postcard_pacs(self):
132119
'download_dir': self.tmp_dir.name}
133120
expected_res = os.path.join(self.tmp_dir.name, obs_id + ".jpg")
134121
hsa = HSAClass()
135-
#res = hsa.download_data(**parameters)
136122
res = self.access_archive_with_retries(hsa.download_data, parameters)
137-
if res == None:
123+
if res is None:
138124
pytest.skip("Archive broke the connection {} times, unable to test".format(self.retries))
139125
assert res == expected_res
140126
assert os.path.isfile(res)
@@ -151,9 +137,8 @@ def test_download_data_postcard_pacs_filename(self):
151137
'download_dir': self.tmp_dir.name}
152138
expected_res = os.path.join(self.tmp_dir.name, fname + ".jpg")
153139
hsa = HSAClass()
154-
#res = hsa.download_data(**parameters)
155140
res = self.access_archive_with_retries(hsa.download_data, parameters)
156-
if res == None:
141+
if res is None:
157142
pytest.skip("Archive broke the connection {} times, unable to test".format(self.retries))
158143
assert res == expected_res
159144
assert os.path.isfile(res)
@@ -168,16 +153,13 @@ def test_get_observation(self):
168153
'download_dir': self.tmp_dir.name}
169154
expected_res = os.path.join(self.tmp_dir.name, obs_id + ".tar")
170155
hsa = HSAClass()
171-
#res = hsa.get_observation(**parameters)
172156
res = self.access_archive_with_retries(hsa.get_observation, parameters)
173-
if res == None:
157+
if res is None:
174158
pytest.skip("Archive broke the connection {} times, unable to test".format(self.retries))
175159
assert res == expected_res
176160
assert os.path.isfile(res)
177-
chksum = []
178161
tar = tarfile.open(res)
179-
for m in tar.getmembers():
180-
chksum.append(m.chksum)
162+
chksum = [m.chksum for m in tar.getmembers()]
181163
assert chksum.sort() == pacs_chksum.sort()
182164
os.remove(res)
183165

@@ -189,9 +171,8 @@ def test_get_postcard(self):
189171
'download_dir': self.tmp_dir.name}
190172
expected_res = os.path.join(self.tmp_dir.name, obs_id + ".jpg")
191173
hsa = HSAClass()
192-
#res = hsa.get_postcard(**parameters)
193174
res = self.access_archive_with_retries(hsa.get_postcard, parameters)
194-
if res == None:
175+
if res is None:
195176
pytest.skip("Archive broke the connection {} times, unable to test".format(self.retries))
196177
assert res == expected_res
197178
assert os.path.isfile(res)

0 commit comments

Comments
 (0)