Skip to content

Commit 83d00cb

Browse files
committed
Increase test coverage
1 parent ba00423 commit 83d00cb

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

pvlib/iotools/meteonorm.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ def get_meteonorm(latitude, longitude, start, end, api_key, endpoint,
100100
meta : dict
101101
Metadata.
102102
103+
Examples
104+
--------
105+
>>> # Retrieve historical time series data
106+
>>> df, meta = get_meteonorm( # doctest: +SKIP
107+
... latitude=50, longitude=10, # doctest: +SKIP
108+
... start='2023-01-01', end='2025-01-01', # doctest: +SKIP
109+
... api_key='redacted', # doctest: +SKIP
110+
... endpoint='observation/training') # doctest: +SKIP
111+
103112
See Also
104113
--------
105114
pvlib.iotools.get_meteonorm_tmy

tests/iotools/test_meteonorm.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,20 @@ def test_get_meteonorm_HTTPError(demo_api_key, demo_url):
221221
url=demo_url)
222222

223223

224+
@pytest.mark.remote_data
225+
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
226+
def test_get_meteonorm_tmy_HTTPError(demo_api_key, demo_url):
227+
with pytest.raises(
228+
HTTPError, match='parameter "surface_azimuth"'):
229+
_ = pvlib.iotools.get_meteonorm_tmy(
230+
latitude=50, longitude=10,
231+
api_key=demo_api_key,
232+
parameters='dhi',
233+
# Infeasible surface_titl
234+
surface_azimuth=400,
235+
url=demo_url)
236+
237+
224238
@pytest.fixture
225239
def expected_meteonorm_tmy_meta():
226240
meta = {
@@ -294,7 +308,7 @@ def test_get_meteonorm_tmy(
294308
horizon=list(np.ones(360).astype(int)*2),
295309
terrain='open',
296310
albedo=0.5,
297-
turbidity='auto',
311+
turbidity=[5.2, 4, 3, 3.1, 3.0, 2.8, 3.14, 3.0, 3, 3, 4, 5],
298312
random_seed=100,
299313
clear_sky_radiation_model='solis',
300314
data_version='v9.0', # fix version

0 commit comments

Comments
 (0)