-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add top-level API with general tests
Fix issue with Mosmix station location conversion
- Loading branch information
Showing
22 changed files
with
336 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2018-2021, earthobservations developers. | ||
# Distributed under the MIT License. See LICENSE for more info. | ||
import pytest | ||
|
||
from wetterdienst import Wetterdienst | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"provider,kind,kwargs", | ||
[ | ||
( | ||
"dwd", | ||
"observation", | ||
{"parameter": "kl", "resolution": "daily", "period": "recent"}, | ||
), | ||
("dwd", "forecast", {"mosmix_type": "large"}), | ||
], | ||
) | ||
def test_api(provider, kind, kwargs): | ||
api = Wetterdienst(provider, kind) | ||
|
||
request = api(**kwargs).all() | ||
|
||
stations = request.df | ||
|
||
assert set(stations.columns).issuperset( | ||
{ | ||
"STATION_ID", | ||
"FROM_DATE", | ||
"TO_DATE", | ||
"HEIGHT", | ||
"LATITUDE", | ||
"LONGITUDE", | ||
"STATION_NAME", | ||
"STATE", | ||
} | ||
) | ||
|
||
assert not stations.empty | ||
|
||
values = next(request.values.query()).df | ||
|
||
# TODO: DWD Forecast has no quality | ||
assert set(values.columns).issuperset( | ||
{"STATION_ID", "PARAMETER", "DATE", "VALUE", "QUALITY"} | ||
) | ||
|
||
assert not values.empty |
Oops, something went wrong.