diff --git a/agenda/holidays.py b/agenda/holidays.py index 175e798..b0af818 100644 --- a/agenda/holidays.py +++ b/agenda/holidays.py @@ -17,7 +17,7 @@ def get_trip_holidays(trip: Trip) -> list[Holiday]: """Get holidays happening during trip.""" if not trip.end: return [] - countries = {c.alpha_2 for c in trip.countries} + countries = {"GB", *(c.alpha_2 for c in trip.countries)} return sorted( ( hol diff --git a/tests/test_holidays.py b/tests/test_holidays.py new file mode 100644 index 0000000..ac428b2 --- /dev/null +++ b/tests/test_holidays.py @@ -0,0 +1,42 @@ +"""Tests for holiday selection.""" + +from datetime import date +from unittest import mock + +import flask + +import agenda.holidays +from agenda.types import Holiday, Trip + + +def test_trip_holidays_include_uk_bank_holiday_for_international_trip() -> None: + """UK bank holidays remain relevant while travelling internationally.""" + trip = Trip( + start=date(2026, 8, 23), + accommodation=[ + { + "name": "Paris hotel", + "location": "Paris", + "country": "fr", + "from": date(2026, 8, 23), + "to": date(2026, 8, 31), + } + ], + ) + summer_bank_holiday = Holiday( + date=date(2026, 8, 31), + name="Summer bank holiday", + country="gb", + ) + app = flask.Flask(__name__) + app.config["DATA_DIR"] = "/unused" + + with ( + app.app_context(), + mock.patch.object( + agenda.holidays, + "get_all", + return_value=[summer_bank_holiday], + ), + ): + assert agenda.holidays.get_trip_holidays(trip) == [summer_bank_holiday]