Move trip new-country filtering into stats

This commit is contained in:
Edward Betts 2026-01-15 22:53:17 +00:00
parent ddfa77b152
commit f22772d12d
5 changed files with 27 additions and 15 deletions

View file

@ -27,3 +27,11 @@ def test_new_country_only_first_year() -> None:
assert czechia in yearly_stats[2024]["new_countries"]
assert czechia in yearly_stats[2026]["countries"]
assert "new_countries" not in yearly_stats[2026]
def test_new_country_respects_previously_visited() -> None:
"""Ensure previously visited countries are excluded from new-country stats."""
trips = [make_trip(date(2024, 5, 1), "CZ")]
yearly_stats = calculate_yearly_stats(trips, {"CZ"})
assert "new_countries" not in yearly_stats[2024]