@@ -273,16 +273,16 @@ def test_get_pvgis_hourly_bad_status_code(requests_mock):
273273
274274def test_get_pvgis_hourly_bad_outputformat (requests_mock ):
275275 # Test if a ValueError is raised if an unsupported outputformat is used
276- # E.g. 'basic' is a valid PVGIS format, but is not supported by pvlib
276+ # error is raised by the PVGIS service, hence it is a HTTPError
277277 requests_mock .get (url_bad_outputformat )
278- with pytest .raises (ValueError ):
279- get_pvgis_hourly (latitude = 45 , longitude = 8 , outputformat = 'basic ' )
278+ with pytest .raises (requests . HTTPError ):
279+ get_pvgis_hourly (latitude = 45 , longitude = 8 , outputformat = 'error ' )
280280
281281
282282def test_get_pvgis_tmy_basic_outputformat ():
283283 # Test if a ValueError is raised if an unsupported outputformat is used
284284 # E.g. 'basic' is a valid PVGIS format, but is not supported by pvlib
285- with pytest .raises (ValueError ):
285+ with pytest .raises (ValueError , match = "outputformat='basic' is no longer" ):
286286 get_pvgis_tmy (latitude = 45 , longitude = 8 , outputformat = 'basic' )
287287
288288
@@ -628,3 +628,8 @@ def test_read_pvgis_tmy_exception():
628628 with pytest .raises (ValueError , match = err_msg ):
629629 read_pvgis_tmy ('filename' , pvgis_format = bad_outputformat ,
630630 map_variables = False )
631+
632+
633+ def test_read_pvgis_tmy_unknown_outputformat ():
634+ with pytest .raises (ValueError , match = "pvgis format 'txt' was unknown" ):
635+ read_pvgis_tmy ("hello.txt" )
0 commit comments