Skip to content

Commit e338188

Browse files
committed
Cleaning up obsolete tests and fixing kwarg usage
1 parent 4f5a927 commit e338188

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

astroquery/alma/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
import tarfile
88
import string
99
import requests
10+
import warnings
11+
1012
from pkg_resources import resource_filename
1113
from bs4 import BeautifulSoup
1214
import pyvo
13-
1415
from urllib.parse import urljoin
16+
1517
from astropy.table import Table, Column, vstack
1618
from astroquery import log
1719
from astropy.utils.console import ProgressBar

astroquery/alma/tests/test_alma_remote.py

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@ def test_SgrAstar(self, temp_dir, alma):
7575
# "The Brick", g0.253, is in this one
7676
# assert b'2011.0.00217.S' in result_c['Project code'] # missing cycle 1 data
7777

78-
def test_docs_example(self, temp_dir, alma):
79-
alma.cache_location = temp_dir
80-
81-
rslt = alma.query(payload=dict(obs_creator_name='*Ginsburg*'))
82-
83-
assert 'ADS/JAO.ALMA#2013.1.00269.S' in rslt['obs_publisher_did']
84-
8578
def test_freq(self, alma):
8679
payload = {'frequency': '85..86'}
8780
result = alma.query(payload)
@@ -141,22 +134,6 @@ def test_m83(self, temp_dir, alma):
141134
# Except it has. On May 18, 2016, there were 47.
142135
assert len(link_list) >= 47
143136

144-
# test re-staging
145-
# (has been replaced with warning)
146-
# with pytest.raises(requests.HTTPError) as ex:
147-
# link_list = alma.stage_data(uids)
148-
# assert ex.value.args[0] == ('Received an error 405: this may indicate you have '
149-
# 'already staged the data. Try downloading the '
150-
# 'file URLs directly with download_files.')
151-
152-
# log.warning doesn't actually make a warning
153-
# link_list = alma.stage_data(uids)
154-
# w = recwarn.pop()
155-
# assert (str(w.message) == ('Error 405 received. If you have previously staged the '
156-
# 'same UIDs, the result returned is probably correct,'
157-
# ' otherwise you may need to create a fresh astroquery.Alma instance.'))
158-
159-
160137
def test_data_proprietary(self, alma):
161138
# public
162139
assert not alma.is_proprietary('uid://A001/X12a3/Xe9')
@@ -198,16 +175,15 @@ def test_data_info(self, temp_dir, alma):
198175
file_url = url
199176
break
200177
assert file_url
201-
alma.download_files([file_url], temp_dir)
178+
alma.download_files([file_url], savedir=temp_dir)
202179
assert os.stat(os.path.join(temp_dir, file)).st_size
203180

204181
# mock downloading an entire program
205182
download_files_mock = Mock()
206183
alma.download_files = download_files_mock
207184
alma.retrieve_data_from_uid([uid])
208185

209-
comparison = download_files_mock.mock_calls[0][1] == data_info_tar[
210-
'access_url']
186+
comparison = download_files_mock.mock_calls[0][1] == data_info_tar['access_url']
211187
assert comparison.all()
212188

213189
def test_download_data(self, temp_dir, alma):
@@ -224,7 +200,7 @@ def test_download_data(self, temp_dir, alma):
224200
alma._download_file = download_mock
225201
urls = [x['access_url'] for x in data_info
226202
if fitsre.match(x['access_url'])]
227-
results = alma.download_files(urls, temp_dir)
203+
results = alma.download_files(urls, savedir=temp_dir)
228204
alma._download_file.call_count == len(results)
229205
assert len(results) == len(urls)
230206

0 commit comments

Comments
 (0)