Skip to content

Commit c5b7a81

Browse files
committed
TST: fixing exception matching
1 parent 8f4cd91 commit c5b7a81

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

astroquery/esa/euclid/tests/test_euclidtap.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -746,11 +746,9 @@ def test_get_product_exceptions():
746746

747747
tap = EuclidClass(tap_plus_conn_handler=conn_handler, datalink_handler=tap_plus, show_server_messages=False)
748748

749-
with pytest.raises(ValueError) as exc_info:
749+
with pytest.raises(ValueError, match="'file_name' and 'product_id' are both None"):
750750
tap.get_product(file_name=None, product_id=None, output_file=None)
751751

752-
str(exc_info.value).startswith("'file_name' and 'product_id' are both None")
753-
754752

755753
@patch.object(TapPlus, 'load_data')
756754
def test_get_product_exceptions_2(mock_load_data, caplog):
@@ -1083,14 +1081,11 @@ def test_get_spectrum_exceptions():
10831081
tap.get_spectrum(source_id='2417660845403252054', schema=None, output_file=None)
10841082

10851083
assert str(exc_info.value).startswith('Missing required argument')
1086-
1087-
with pytest.raises(ValueError) as exc_info:
1084+
with pytest.raises(ValueError, match=(
1085+
"Invalid argument value for 'retrieval_type'. Found hola, expected: 'ALL' or any of \\['SPECTRA_BGS', "
1086+
"'SPECTRA_RGS'\\]")):
10881087
tap.get_spectrum(retrieval_type='hola', source_id='2417660845403252054', schema='schema', output_file=None)
10891088

1090-
assert str(exc_info.value).startswith(
1091-
"Invalid mandatory argument 'retrieval_type'. Found hola, expected: 'ALL' or any of ['SPECTRA_BGS', "
1092-
"'SPECTRA_RGS']")
1093-
10941089

10951090
@patch.object(TapPlus, 'login')
10961091
def test_login(mock_login):

0 commit comments

Comments
 (0)