Skip to content

Commit dc0fac9

Browse files
Jorge Fernandez HernandezJorge Fernandez Hernandez
authored andcommitted
GAIASWRQ-25 Fix tests due to the last changes in method cross_match_stream
1 parent 50ccd05 commit dc0fac9

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

astroquery/esa/euclid/tests/test_euclidtap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def test_load_table():
272272
responseLaunchJob = DummyResponse(200)
273273
responseLaunchJob.set_data(method='GET', context=None, body=TABLE_DATA, headers=None)
274274

275-
table = 'my_table'
275+
table = 'schema.my_table'
276276
conn_handler.set_response(f"tables?tables={table}", responseLaunchJob)
277277
tap = EuclidClass(tap_plus_conn_handler=conn_handler, datalink_handler=tap_plus, show_server_messages=False)
278278

astroquery/gaia/core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,9 @@ def cross_match(self, *, full_qualified_table_name_a,
10261026

10271027
table_b = taputils.get_table_name(full_qualified_table_name_b)
10281028

1029+
if taputils.get_schema_name(results_table_name) is not None:
1030+
raise ValueError("Please, do not specify schema for 'results_table_name'")
1031+
10291032
query = f"SELECT crossmatch_positional('{schema_a}','{table_a}','{schema_b}','{table_b}',{radius}, " \
10301033
f"'{results_table_name}') FROM dual;"
10311034

astroquery/gaia/tests/test_gaiatap.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,16 +1338,14 @@ def test_cross_match(background, cross_match_kwargs, mock_querier_async):
13381338
"kwarg,invalid_value,error_message",
13391339
[("full_qualified_table_name_a",
13401340
"tableA",
1341-
"^Not found schema name in full qualified table A: 'tableA'$"),
1341+
"^Not found schema name in full qualified table: 'tableA'$"),
13421342
("full_qualified_table_name_b",
13431343
"tableB",
1344-
"^Not found schema name in full qualified table B: 'tableB'$"),
1344+
"^Not found schema name in full qualified table: 'tableB'$"),
13451345
("results_table_name",
13461346
"schema.results",
13471347
"^Please, do not specify schema for 'results_table_name'$")])
1348-
def test_cross_match_invalid_mandatory_kwarg(
1349-
cross_match_kwargs, kwarg, invalid_value, error_message
1350-
):
1348+
def test_cross_match_invalid_mandatory_kwarg(cross_match_kwargs, kwarg, invalid_value, error_message):
13511349
cross_match_kwargs[kwarg] = invalid_value
13521350
with pytest.raises(ValueError, match=error_message):
13531351
GAIA_QUERIER.cross_match(**cross_match_kwargs)
@@ -1411,7 +1409,11 @@ def load_table_monkeypatched(self, table, verbose):
14111409
return_val = {"user_hola.tableA": tap_table_a, "user_hola.tableB": tap_table_b}
14121410
return return_val[table]
14131411

1412+
def update_user_table(self, table_name, list_of_changes, verbose):
1413+
return None
1414+
14141415
monkeypatch.setattr(Tap, "load_table", load_table_monkeypatched)
1416+
monkeypatch.setattr(TapPlus, "update_user_table", update_user_table)
14151417

14161418
job = mock_querier_async.cross_match_stream(**cross_match_stream_2_kwargs, background=background)
14171419
assert job.async_ is True
@@ -1421,14 +1423,20 @@ def load_table_monkeypatched(self, table, verbose):
14211423

14221424
@pytest.mark.parametrize("background", [False, True])
14231425
def test_cross_match_stream_3(monkeypatch, background, mock_querier_async):
1424-
def load_table_monkeypatched(self, table, verbose):
1426+
mock_querier_async.MAIN_GAIA_TABLE = None
1427+
1428+
def load_table_monkeypatched_2(self, table, verbose):
14251429
tap_table_a = make_table_metadata("user_hola.tableA")
14261430
tap_table_b = make_table_metadata("gaiadr3.gaia_source")
14271431

14281432
return_val = {"user_hola.tableA": tap_table_a, "gaiadr3.gaia_source": tap_table_b}
14291433
return return_val[table]
14301434

1431-
monkeypatch.setattr(Tap, "load_table", load_table_monkeypatched)
1435+
def update_user_table(self, table_name, list_of_changes, verbose):
1436+
return None
1437+
1438+
monkeypatch.setattr(Tap, "load_table", load_table_monkeypatched_2)
1439+
monkeypatch.setattr(TapPlus, "update_user_table", update_user_table)
14321440

14331441
job = mock_querier_async.cross_match_stream(table_a_full_qualified_name="user_hola.tableA", table_a_column_ra="ra",
14341442
table_a_column_dec="dec", background=background)

astroquery/utils/tap/tests/test_tap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ def test_get_current_column_values_for_update():
778778

779779

780780
def test_update_user_table():
781-
tableName = 'table'
781+
tableName = 'schema.table'
782782
conn_handler = DummyConnHandler()
783783
tap = TapPlus(url="http://test:1111/tap", connhandler=conn_handler)
784784
dummyResponse = DummyResponse(200)

0 commit comments

Comments
 (0)