From 277e991869ca1366760e8b737cceb15cc05742d2 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 18 May 2024 20:37:10 +0200 Subject: [PATCH] Validate airport and station YAML --- validate_yaml.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/validate_yaml.py b/validate_yaml.py index 44b9925..d23fd0e 100755 --- a/validate_yaml.py +++ b/validate_yaml.py @@ -2,12 +2,15 @@ """Load YAML data to ensure validity.""" import os +import typing from datetime import date, timedelta +import agenda import agenda.conference import agenda.data import agenda.travel import agenda.trip +import agenda.types config = __import__("config.default", fromlist=[""]) @@ -35,3 +38,18 @@ next_year = today + timedelta(days=2 * 365) events = agenda.events_yaml.read(data_dir, last_year, next_year) print(len(events), "events") + +airports = typing.cast( + dict[str, agenda.types.StrDict], agenda.travel.parse_yaml("airports", data_dir) +) +print(len(airports), "airports") +for airport in airports.values(): + assert "country" in airport + assert agenda.get_country(airport["country"]) + + +stations = agenda.travel.parse_yaml("stations", data_dir) +print(len(stations), "stations") +for station in stations: + assert "country" in station + assert agenda.get_country(station["country"])