Skip to content

Commit e556a24

Browse files
committed
Correct names of constants in gaia tests
A very common Python convention is that names of constants should be in capital letters, but `gaia` tests contained two constants that did not follow this convention.
1 parent cf20d9a commit e556a24

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

astroquery/gaia/tests/test_gaiatap.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@
3232

3333

3434
GAIA_QUERIER = GaiaClass(show_server_messages=False)
35-
job_data = (Path(__file__).with_name("data") / "job_1.vot").read_text()
36-
37-
skycoord = SkyCoord(ra=19 * u.deg, dec=20 * u.deg, frame="icrs")
35+
JOB_DATA = (Path(__file__).with_name("data") / "job_1.vot").read_text()
36+
SKYCOORD = SkyCoord(ra=19 * u.deg, dec=20 * u.deg, frame="icrs")
3837

3938

4039
@pytest.fixture(scope="module")
@@ -56,7 +55,7 @@ def mock_querier():
5655
conn_handler = DummyConnHandler()
5756
tapplus = TapPlus("http://test:1111/tap", connhandler=conn_handler)
5857
launch_response = DummyResponse(200)
59-
launch_response.set_data(method="POST", body=job_data)
58+
launch_response.set_data(method="POST", body=JOB_DATA)
6059
# The query contains decimals: default response is more robust.
6160
conn_handler.set_default_response(launch_response)
6261
return GaiaClass(tap_plus_conn_handler=conn_handler, datalink_handler=tapplus, show_server_messages=False)
@@ -78,7 +77,7 @@ def mock_querier_async():
7877
conn_handler.set_response("async/" + jobid + "/phase", phase_response)
7978

8079
results_response = DummyResponse(200)
81-
results_response.set_data(method="GET", body=job_data)
80+
results_response.set_data(method="GET", body=JOB_DATA)
8281
conn_handler.set_response("async/" + jobid + "/results/result", results_response)
8382

8483
return GaiaClass(tap_plus_conn_handler=conn_handler, datalink_handler=tapplus, show_server_messages=False)
@@ -104,42 +103,42 @@ def test_show_message():
104103

105104
def test_query_object(column_attrs, mock_querier):
106105
with pytest.raises(ValueError) as err:
107-
mock_querier.query_object(skycoord)
106+
mock_querier.query_object(SKYCOORD)
108107
assert "Missing required argument: width" in err.value.args[0]
109108

110109
width = 12 * u.deg
111110

112111
with pytest.raises(ValueError) as err:
113-
mock_querier.query_object(skycoord, width=width)
112+
mock_querier.query_object(SKYCOORD, width=width)
114113
assert "Missing required argument: height" in err.value.args[0]
115114

116-
table = mock_querier.query_object(skycoord, width=width, height=10 * u.deg)
115+
table = mock_querier.query_object(SKYCOORD, width=width, height=10 * u.deg)
117116
assert len(table) == 3
118117
for colname, attrs in column_attrs.items():
119118
assert table[colname].attrs_equal(attrs)
120119
# by radius
121-
table = mock_querier.query_object(skycoord, radius=1 * u.deg)
120+
table = mock_querier.query_object(SKYCOORD, radius=1 * u.deg)
122121
assert len(table) == 3
123122
for colname, attrs in column_attrs.items():
124123
assert table[colname].attrs_equal(attrs)
125124

126125

127126
def test_query_object_async(column_attrs, mock_querier_async):
128127
table = mock_querier_async.query_object_async(
129-
skycoord, width=12 * u.deg, height=10 * u.deg
128+
SKYCOORD, width=12 * u.deg, height=10 * u.deg
130129
)
131130
assert len(table) == 3
132131
for colname, attrs in column_attrs.items():
133132
assert table[colname].attrs_equal(attrs)
134133
# by radius
135-
table = mock_querier_async.query_object_async(skycoord, radius=1 * u.deg)
134+
table = mock_querier_async.query_object_async(SKYCOORD, radius=1 * u.deg)
136135
assert len(table) == 3
137136
for colname, attrs in column_attrs.items():
138137
assert table[colname].attrs_equal(attrs)
139138

140139

141140
def test_cone_search_sync(column_attrs, mock_querier):
142-
job = mock_querier.cone_search(skycoord, radius=1 * u.deg)
141+
job = mock_querier.cone_search(SKYCOORD, radius=1 * u.deg)
143142
assert job.async_ is False
144143
assert job.get_phase() == "COMPLETED"
145144
assert job.failed is False
@@ -152,7 +151,7 @@ def test_cone_search_sync(column_attrs, mock_querier):
152151

153152
def test_cone_search_async(column_attrs, mock_querier_async):
154153
radius = 1.0 * u.deg
155-
job = mock_querier_async.cone_search_async(skycoord, radius=radius)
154+
job = mock_querier_async.cone_search_async(SKYCOORD, radius=radius)
156155
assert job.async_ is True
157156
assert job.get_phase() == "COMPLETED"
158157
assert job.failed is False
@@ -167,11 +166,11 @@ def test_cone_search_async(column_attrs, mock_querier_async):
167166
# The preceding tests should have used the default value.
168167
assert 'gaiadr3.gaia_source' in job.parameters['query']
169168
with conf.set_temp("MAIN_GAIA_TABLE", "name_from_conf"):
170-
job = mock_querier_async.cone_search_async(skycoord, radius=radius)
169+
job = mock_querier_async.cone_search_async(SKYCOORD, radius=radius)
171170
assert "name_from_conf" in job.parameters["query"]
172171
# Changing the value through the class should overrule conf.
173172
mock_querier_async.MAIN_GAIA_TABLE = "name_from_class"
174-
job = mock_querier_async.cone_search_async(skycoord, radius=radius)
173+
job = mock_querier_async.cone_search_async(SKYCOORD, radius=radius)
175174
assert "name_from_class" in job.parameters["query"]
176175

177176

0 commit comments

Comments
 (0)