Add support for heat warning type (id=10)

This commit is contained in:
Jules 2025-06-18 18:48:30 +02:00
parent bd3b4e0a84
commit c6c4d9b585
Signed by: jdejaegh
GPG key ID: 99D6D184CA66933A
4 changed files with 1664 additions and 0 deletions

View file

@ -27,6 +27,7 @@ MAP_WARNING_ID_TO_SLUG: Final = {
3: WarningType.THUNDER,
7: WarningType.FOG,
9: WarningType.COLD,
10: WarningType.HEAT,
12: WarningType.THUNDER_WIND_RAIN,
13: WarningType.THUNDERSTORM_STRONG_GUSTS,
14: WarningType.THUNDERSTORM_LARGE_RAINFALL,

View file

@ -80,6 +80,7 @@ class WarningType(StrEnum):
COLD = 'cold'
COLDSPELL = 'coldspell'
FOG = 'fog'
HEAT = 'heat'
ICE_OR_SNOW = 'ice_or_snow'
RAIN = 'rain'
STORM_SURGE = 'storm_surge'

File diff suppressed because it is too large Load diff

View file

@ -24,6 +24,21 @@ async def test_warning_data() -> None:
assert first.get('id') == 7
assert first.get('level') == 1
async def test_warning_heat() -> None:
api = get_api_with_data("antwerp_with_heat_warning.json")
result = api.get_warnings(lang='en')
assert isinstance(result, list)
assert len(result) == 1
first = result[0]
assert first.get('slug') == WarningType.HEAT
assert first.get('friendly_name') == 'Heat'
assert first.get('id') == 10
assert first.get('level') == 1
async def test_warning_data_is_serializable() -> None:
api = get_api_with_data("be_forecast_warning.json")