5
5
from astropy import units as u
6
6
from astropy .coordinates import SkyCoord
7
7
from astropy .tests .helper import remote_data
8
- import astropy .io .fits as pyfits
9
8
# Local packages
10
9
from .. import Noirlab
11
10
from . import expected as exp
12
- # #!import pytest
13
11
14
12
# performs similar tests as test_module.py, but performs
15
13
# the actual HTTP request rather than monkeypatching them.
20
18
@remote_data
21
19
class TestNoirlabClass (object ):
22
20
23
- ###############################################################
24
- ### (2) SIA; /api/sia/
25
- ###
21
+ # # ##############################################################
22
+ # # ## (2) SIA; /api/sia/
23
+ # # ##
26
24
# voimg, vohdu
27
25
28
26
def test_service_metadata (self ):
@@ -32,7 +30,7 @@ def test_service_metadata(self):
32
30
print (f'DBG: test_service_metadata={ actual } ' )
33
31
expected = exp .service_metadata
34
32
assert actual == expected
35
-
33
+
36
34
def test_query_region_0 (self ):
37
35
"""Search FILES using default type (which) selector"""
38
36
@@ -64,19 +62,19 @@ def test_query_region_2(self):
64
62
expected = exp .query_region_2
65
63
assert expected .issubset (actual )
66
64
67
- ###############################################################
68
- ### (7) Advanced Search; /api/adv_search/
69
- ###
65
+ # # ##############################################################
66
+ # # ## (7) Advanced Search; /api/adv_search/
67
+ # # ##
70
68
#
71
69
# (2) aux_{file,hdu}_fields/<instrument>/<proctype>
72
70
# (2) core_{file,hdu}_fields/
73
71
# [(2) {f,h}adoc JUST LINK to these]
74
72
# (2) {f,h}asearch
75
73
# cat_list
76
74
77
- ##
78
- ## File (default type)
79
- ##
75
+ # # #
76
+ # # # File (default type)
77
+ # # #
80
78
81
79
def test_aux_file_fields (self ):
82
80
"""List the available AUX FILE fields."""
@@ -89,36 +87,35 @@ def test_aux_file_fields(self):
89
87
def test_core_file_fields (self ):
90
88
"""List the available CORE FILE fields."""
91
89
r = Noirlab ().core_fields ()
92
- actual = r # set(list(r['md5sum']))
90
+ actual = r
93
91
print (f'DBG: test_core_file_fields={ actual } ' )
94
92
expected = exp .core_file_fields
95
93
assert actual == expected
96
94
97
95
def test_query_file_metadata (self ):
98
96
"""Search FILE metadata."""
99
97
qspec = {
100
- "outfields" : [
98
+ "outfields" : [
101
99
"md5sum" ,
102
100
"archive_filename" ,
103
101
"original_filename" ,
104
102
"instrument" ,
105
103
"proc_type"
106
104
],
107
- "search" : [
105
+ "search" : [
108
106
['original_filename' , 'c4d_' , 'contains' ]
109
107
]
110
108
}
111
109
112
110
r = Noirlab ().query_metadata (qspec , limit = 3 )
113
- actual = r # set(list(r['md5sum']))
111
+ actual = r
114
112
print (f'DBG: test_query_file_metadata={ actual .pformat_all ()} ' )
115
113
expected = exp .query_file_metadata
116
114
assert actual .pformat_all () == expected
117
115
118
-
119
- ##
120
- ## HDU
121
- ##
116
+ # ##
117
+ # ## HDU
118
+ # ##
122
119
123
120
def test_aux_hdu_fields (self ):
124
121
"""List the available AUX HDU fields."""
@@ -131,50 +128,48 @@ def test_aux_hdu_fields(self):
131
128
def test_core_hdu_fields (self ):
132
129
"""List the available CORE HDU fields."""
133
130
r = Noirlab (which = 'hdu' ).core_fields ()
134
- actual = r # set(list(r['md5sum']))
131
+ actual = r
135
132
print (f'DBG: test_core_hdu_fields={ actual } ' )
136
133
expected = exp .core_hdu_fields
137
134
assert actual == expected
138
135
139
136
def test_query_hdu_metadata (self ):
140
137
"""Search HDU metadata."""
141
138
qspec = {
142
- "outfields" : [
139
+ "outfields" : [
143
140
"fitsfile__archive_filename" ,
144
141
"fitsfile__caldat" ,
145
142
"fitsfile__instrument" ,
146
143
"fitsfile__proc_type" ,
147
144
"AIRMASS" # AUX field. Slows search
148
145
],
149
- "search" : [
146
+ "search" : [
150
147
["fitsfile__caldat" , "2017-08-14" , "2017-08-16" ],
151
148
["fitsfile__instrument" , "decam" ],
152
149
["fitsfile__proc_type" , "raw" ]
153
150
]
154
151
}
155
152
156
153
r = Noirlab (which = 'hdu' ).query_metadata (qspec , limit = 3 )
157
- actual = r # set(list(r['md5sum']))
154
+ actual = r
158
155
print (f'DBG: test_query_hdu_metadata={ actual .pformat_all ()} ' )
159
156
expected = exp .query_hdu_metadata
160
157
assert actual .pformat_all () == expected
161
158
162
- ##
163
- ## Agnostic
164
- ##
159
+ # # #
160
+ # # # Agnostic
161
+ # # #
165
162
166
163
def test_categoricals (self ):
167
164
"""List categories."""
168
165
r = Noirlab ().categoricals ()
169
- actual = r # set(list(r['md5sum']))
166
+ actual = r
170
167
print (f'DBG: test_categoricals={ actual } ' )
171
168
expected = exp .categoricals
172
169
assert actual == expected
173
170
174
-
175
-
176
- ###############################################################
177
- ### (3) Other
171
+ # ##############################################################
172
+ # ### (3) Other
178
173
# get_token
179
174
# retrieve/<md5>
180
175
# version
@@ -186,7 +181,6 @@ def test_retrieve(self):
186
181
expected = exp .retrieve
187
182
assert actual == expected
188
183
189
-
190
184
def test_version (self ):
191
185
r = Noirlab ().version ()
192
186
assert r < 3.0
@@ -197,6 +191,3 @@ def test_get_token(self):
197
191
'No active account found with the given credentials' }
198
192
print (f'DBG: test_get_token={ actual } ' )
199
193
assert actual == expected
200
-
201
-
202
-
0 commit comments