@@ -117,16 +117,18 @@ def test_get_psm3_check_leap_day(nrel_api_key):
117
117
assert len (data_2012 ) == (8760 + 24 )
118
118
119
119
120
- @pytest .mark .parametrize ('latitude, longitude, api_key, names, interval' ,
121
- [(LATITUDE , LONGITUDE , 'BAD' , 'tmy-2017' , 60 ),
122
- (51 , - 5 , nrel_api_key , 'tmy-2017' , 60 ),
123
- (LATITUDE , LONGITUDE , nrel_api_key , 'bad' , 60 ),
124
- (LATITUDE , LONGITUDE , nrel_api_key , '2017' , 15 ),
120
+ @pytest .mark .parametrize ('latitude, longitude, api_key, names, interval, url' ,
121
+ [(LATITUDE , LONGITUDE , 'BAD' , 'tmy-2017' , 60 , None ),
122
+ (51 , - 5 , nrel_api_key , 'tmy-2017' , 60 , None ),
123
+ (LATITUDE , LONGITUDE , nrel_api_key , 'bad' , 60 , None ),
124
+ (LATITUDE , LONGITUDE , nrel_api_key , '2017' , 15 , None ),
125
+ (LATITUDE , LONGITUDE , nrel_api_key , '2017' , 60 ,
126
+ 'https://developer.nrel.gov/api/nsrdb/v2/bad' ),
125
127
])
126
128
@pytest .mark .remote_data
127
129
@pytest .mark .flaky (reruns = RERUNS , reruns_delay = RERUNS_DELAY )
128
130
def test_get_psm3_tmy_errors (
129
- latitude , longitude , api_key , names , interval
131
+ latitude , longitude , api_key , names , interval , url
130
132
):
131
133
"""Test get_psm3() for multiple erroneous input scenarios.
132
134
@@ -135,10 +137,11 @@ def test_get_psm3_tmy_errors(
135
137
* Bad latitude/longitude -> Coordinates were not found in the NSRDB.
136
138
* Bad name -> Name is not one of the available options.
137
139
* Bad interval, single year -> Intervals can only be 30 or 60 minutes.
140
+ * Bad url -> Not Found.
138
141
"""
139
142
with pytest .raises (HTTPError ) as excinfo :
140
143
psm3 .get_psm3 (latitude , longitude , api_key , PVLIB_EMAIL ,
141
- names = names , interval = interval , leap_day = False ,
144
+ names = names , interval = interval , url = url , leap_day = False ,
142
145
map_variables = False )
143
146
# ensure the HTTPError caught isn't due to overuse of the API key
144
147
assert "OVER_RATE_LIMIT" not in str (excinfo .value )
0 commit comments