@@ -273,16 +273,16 @@ def test_get_pvgis_hourly_bad_status_code(requests_mock):
273
273
274
274
def test_get_pvgis_hourly_bad_outputformat (requests_mock ):
275
275
# 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
277
277
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 ' )
280
280
281
281
282
282
def test_get_pvgis_tmy_basic_outputformat ():
283
283
# Test if a ValueError is raised if an unsupported outputformat is used
284
284
# 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" ):
286
286
get_pvgis_tmy (latitude = 45 , longitude = 8 , outputformat = 'basic' )
287
287
288
288
@@ -628,3 +628,8 @@ def test_read_pvgis_tmy_exception():
628
628
with pytest .raises (ValueError , match = err_msg ):
629
629
read_pvgis_tmy ('filename' , pvgis_format = bad_outputformat ,
630
630
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