55from astropy import units as u
66from astropy .coordinates import SkyCoord
77from astropy .tests .helper import remote_data
8- import astropy .io .fits as pyfits
98# Local packages
109from .. import Noirlab
1110from . import expected as exp
12- # #!import pytest
1311
1412# performs similar tests as test_module.py, but performs
1513# the actual HTTP request rather than monkeypatching them.
2018@remote_data
2119class TestNoirlabClass (object ):
2220
23- ###############################################################
24- ### (2) SIA; /api/sia/
25- ###
21+ # # ##############################################################
22+ # # ## (2) SIA; /api/sia/
23+ # # ##
2624 # voimg, vohdu
2725
2826 def test_service_metadata (self ):
@@ -32,7 +30,7 @@ def test_service_metadata(self):
3230 print (f'DBG: test_service_metadata={ actual } ' )
3331 expected = exp .service_metadata
3432 assert actual == expected
35-
33+
3634 def test_query_region_0 (self ):
3735 """Search FILES using default type (which) selector"""
3836
@@ -64,19 +62,19 @@ def test_query_region_2(self):
6462 expected = exp .query_region_2
6563 assert expected .issubset (actual )
6664
67- ###############################################################
68- ### (7) Advanced Search; /api/adv_search/
69- ###
65+ # # ##############################################################
66+ # # ## (7) Advanced Search; /api/adv_search/
67+ # # ##
7068 #
7169 # (2) aux_{file,hdu}_fields/<instrument>/<proctype>
7270 # (2) core_{file,hdu}_fields/
7371 # [(2) {f,h}adoc JUST LINK to these]
7472 # (2) {f,h}asearch
7573 # cat_list
7674
77- ##
78- ## File (default type)
79- ##
75+ # # #
76+ # # # File (default type)
77+ # # #
8078
8179 def test_aux_file_fields (self ):
8280 """List the available AUX FILE fields."""
@@ -89,36 +87,35 @@ def test_aux_file_fields(self):
8987 def test_core_file_fields (self ):
9088 """List the available CORE FILE fields."""
9189 r = Noirlab ().core_fields ()
92- actual = r # set(list(r['md5sum']))
90+ actual = r
9391 print (f'DBG: test_core_file_fields={ actual } ' )
9492 expected = exp .core_file_fields
9593 assert actual == expected
9694
9795 def test_query_file_metadata (self ):
9896 """Search FILE metadata."""
9997 qspec = {
100- "outfields" : [
98+ "outfields" : [
10199 "md5sum" ,
102100 "archive_filename" ,
103101 "original_filename" ,
104102 "instrument" ,
105103 "proc_type"
106104 ],
107- "search" : [
105+ "search" : [
108106 ['original_filename' , 'c4d_' , 'contains' ]
109107 ]
110108 }
111109
112110 r = Noirlab ().query_metadata (qspec , limit = 3 )
113- actual = r # set(list(r['md5sum']))
111+ actual = r
114112 print (f'DBG: test_query_file_metadata={ actual .pformat_all ()} ' )
115113 expected = exp .query_file_metadata
116114 assert actual .pformat_all () == expected
117115
118-
119- ##
120- ## HDU
121- ##
116+ # ##
117+ # ## HDU
118+ # ##
122119
123120 def test_aux_hdu_fields (self ):
124121 """List the available AUX HDU fields."""
@@ -131,50 +128,48 @@ def test_aux_hdu_fields(self):
131128 def test_core_hdu_fields (self ):
132129 """List the available CORE HDU fields."""
133130 r = Noirlab (which = 'hdu' ).core_fields ()
134- actual = r # set(list(r['md5sum']))
131+ actual = r
135132 print (f'DBG: test_core_hdu_fields={ actual } ' )
136133 expected = exp .core_hdu_fields
137134 assert actual == expected
138135
139136 def test_query_hdu_metadata (self ):
140137 """Search HDU metadata."""
141138 qspec = {
142- "outfields" : [
139+ "outfields" : [
143140 "fitsfile__archive_filename" ,
144141 "fitsfile__caldat" ,
145142 "fitsfile__instrument" ,
146143 "fitsfile__proc_type" ,
147144 "AIRMASS" # AUX field. Slows search
148145 ],
149- "search" : [
146+ "search" : [
150147 ["fitsfile__caldat" , "2017-08-14" , "2017-08-16" ],
151148 ["fitsfile__instrument" , "decam" ],
152149 ["fitsfile__proc_type" , "raw" ]
153150 ]
154151 }
155152
156153 r = Noirlab (which = 'hdu' ).query_metadata (qspec , limit = 3 )
157- actual = r # set(list(r['md5sum']))
154+ actual = r
158155 print (f'DBG: test_query_hdu_metadata={ actual .pformat_all ()} ' )
159156 expected = exp .query_hdu_metadata
160157 assert actual .pformat_all () == expected
161158
162- ##
163- ## Agnostic
164- ##
159+ # # #
160+ # # # Agnostic
161+ # # #
165162
166163 def test_categoricals (self ):
167164 """List categories."""
168165 r = Noirlab ().categoricals ()
169- actual = r # set(list(r['md5sum']))
166+ actual = r
170167 print (f'DBG: test_categoricals={ actual } ' )
171168 expected = exp .categoricals
172169 assert actual == expected
173170
174-
175-
176- ###############################################################
177- ### (3) Other
171+ # ##############################################################
172+ # ### (3) Other
178173 # get_token
179174 # retrieve/<md5>
180175 # version
@@ -186,7 +181,6 @@ def test_retrieve(self):
186181 expected = exp .retrieve
187182 assert actual == expected
188183
189-
190184 def test_version (self ):
191185 r = Noirlab ().version ()
192186 assert r < 3.0
@@ -197,6 +191,3 @@ def test_get_token(self):
197191 'No active account found with the given credentials' }
198192 print (f'DBG: test_get_token={ actual } ' )
199193 assert actual == expected
200-
201-
202-
0 commit comments