Skip to content

Commit 45b0461

Browse files
Jorge Fernandez HernandezJorge Fernandez Hernandez
authored andcommitted
GAIAMNGT-1700 New test to check the exception
1 parent 536f39c commit 45b0461

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

astroquery/gaia/tests/test_gaiatap.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,30 @@ def test_cone_search_and_changing_MAIN_GAIA_TABLE(mock_querier_async):
781781
assert "name_from_class" in job.parameters["query"]
782782

783783

784+
def test_datalink_querier_load_data_vot_exception(mock_datalink_querier):
785+
file_final = os.path.join(os.getcwd(), 'datalink_output.zip')
786+
Path(file_final).touch()
787+
788+
assert os.path.exists(file_final)
789+
790+
with pytest.raises(ValueError) as excinfo:
791+
mock_datalink_querier.load_data(ids=[5937083312263887616], data_release='Gaia DR3',
792+
data_structure='INDIVIDUAL',
793+
retrieval_type="ALL",
794+
linking_parameter='SOURCE_ID', valid_data=False, band=None,
795+
avoid_datatype_check=False,
796+
format="votable", dump_to_file=True, overwrite_output_file=False,
797+
verbose=False)
798+
799+
assert str(
800+
excinfo.value) == (f"{file_final} file already exists. Please use overwrite_output_file='True' to overwrite "
801+
f"output file.")
802+
803+
os.remove(file_final)
804+
805+
assert not os.path.exists(file_final)
806+
807+
784808
def test_datalink_querier_load_data_vot(mock_datalink_querier):
785809
result_dict = mock_datalink_querier.load_data(ids=[5937083312263887616], data_release='Gaia DR3',
786810
data_structure='INDIVIDUAL',

0 commit comments

Comments
 (0)