Skip to content

Commit 31dcd5d

Browse files
committed
test
1 parent e76bc0c commit 31dcd5d

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

pvlib/tests/iotools/test_psm3.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,18 @@ def test_get_psm3_check_leap_day(nrel_api_key):
117117
assert len(data_2012) == (8760 + 24)
118118

119119

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'),
125127
])
126128
@pytest.mark.remote_data
127129
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
128130
def test_get_psm3_tmy_errors(
129-
latitude, longitude, api_key, names, interval
131+
latitude, longitude, api_key, names, interval, url
130132
):
131133
"""Test get_psm3() for multiple erroneous input scenarios.
132134
@@ -135,10 +137,11 @@ def test_get_psm3_tmy_errors(
135137
* Bad latitude/longitude -> Coordinates were not found in the NSRDB.
136138
* Bad name -> Name is not one of the available options.
137139
* Bad interval, single year -> Intervals can only be 30 or 60 minutes.
140+
* Bad url -> Not Found.
138141
"""
139142
with pytest.raises(HTTPError) as excinfo:
140143
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,
142145
map_variables=False)
143146
# ensure the HTTPError caught isn't due to overuse of the API key
144147
assert "OVER_RATE_LIMIT" not in str(excinfo.value)

0 commit comments

Comments
 (0)