@@ -87,7 +87,8 @@ def test_freq(self, alma):
87
87
88
88
def test_bands (self , alma ):
89
89
payload = {'band_list' : ['5' , '7' ]}
90
- result = alma .query (payload )
90
+ # Added maxrec here as downloading and reading the results take too long.
91
+ result = alma .query (payload , maxrec = 1000 )
91
92
assert len (result ) > 0
92
93
for row in result :
93
94
assert ('5' in row ['band_list' ]) or ('7' in row ['band_list' ])
@@ -136,7 +137,7 @@ def test_data_proprietary(self, alma):
136
137
assert not alma .is_proprietary ('uid://A001/X12a3/Xe9' )
137
138
IVOA_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S.%f"
138
139
now = datetime .utcnow ().strftime (IVOA_DATE_FORMAT )[:- 3 ]
139
- query = "select top 1 obs_id from ivoa.obscore where " \
140
+ query = "select top 1 member_ous_uid from ivoa.obscore where " \
140
141
"obs_release_date > '{}'" .format (now )
141
142
result = alma .query_tap (query )
142
143
assert len (result .table ) == 1
@@ -146,6 +147,7 @@ def test_data_proprietary(self, alma):
146
147
with pytest .raises (AttributeError ):
147
148
alma .is_proprietary ('uid://NON/EXI/STING' )
148
149
150
+ @pytest .mark .xfail (reason = "Depends on PR 2438 (https://github.com/astropy/astroquery/pull/2438)" )
149
151
def test_data_info (self , temp_dir , alma ):
150
152
alma .cache_location = temp_dir
151
153
@@ -257,6 +259,7 @@ def test_doc_example(self, temp_dir, alma):
257
259
gc_data = alma .query_region (galactic_center , 1 * u .deg )
258
260
# assert len(gc_data) >= 425 # Feb 8, 2016
259
261
assert len (gc_data ) >= 50 # Nov 16, 2016
262
+ content_length_column_name = 'content_length'
260
263
261
264
uids = np .unique (m83_data ['Member ous id' ])
262
265
if ASTROPY_LT_4_1 :
@@ -271,11 +274,11 @@ def test_doc_example(self, temp_dir, alma):
271
274
assert X30 .sum () == 4 # Jul 13, 2020
272
275
assert X31 .sum () == 4 # Jul 13, 2020
273
276
mous1 = alma .get_data_info ('uid://A001/X11f/X30' )
274
- totalsize_mous1 = mous1 ['size' ].sum () * u .Unit (mous1 ['size' ].unit )
277
+ totalsize_mous1 = mous1 [content_length_column_name ].sum () * u .Unit (mous1 [content_length_column_name ].unit )
275
278
assert (totalsize_mous1 .to (u .B ) > 1.9 * u .GB )
276
279
277
280
mous = alma .get_data_info ('uid://A002/X3216af/X31' )
278
- totalsize_mous = mous ['size' ].sum () * u .Unit (mous ['size' ].unit )
281
+ totalsize_mous = mous [content_length_column_name ].sum () * u .Unit (mous [content_length_column_name ].unit )
279
282
# More recent ALMA request responses do not include any information
280
283
# about file size, so we have to allow for the possibility that all
281
284
# file sizes are replaced with -1
@@ -313,11 +316,13 @@ def test_misc(self, alma):
313
316
result = alma .query (payload = {'pi_name' : '*Bally*' }, public = False ,
314
317
maxrec = 10 )
315
318
assert result
316
- result .write ('/tmp/alma-onerow.txt' , format = 'ascii' )
319
+ # Add overwrite=True in case the test previously died unexpectedly
320
+ # and left the temp file.
321
+ result .write ('/tmp/alma-onerow.txt' , format = 'ascii' , overwrite = True )
317
322
for row in result :
318
323
assert 'Bally' in row ['obs_creator_name' ]
319
324
result = alma .query (payload = dict (project_code = '2016.1.00165.S' ),
320
- public = False , cache = False )
325
+ public = False )
321
326
assert result
322
327
for row in result :
323
328
assert '2016.1.00165.S' == row ['proposal_id' ]
@@ -336,8 +341,7 @@ def test_misc(self, alma):
336
341
337
342
result = alma .query_region (
338
343
coordinates .SkyCoord ('5:35:14.461 -5:21:54.41' , frame = 'fk5' ,
339
- unit = (u .hour , u .deg )), radius = 0.034 * u .deg ,
340
- payload = {'energy.frequency-asu' : '215 .. 220' })
344
+ unit = (u .hour , u .deg )), radius = 0.034 * u .deg )
341
345
342
346
result = alma .query (payload = dict (project_code = '2012.*' ,
343
347
public_data = True ))
0 commit comments