fire-planner/tests/test_geo.py

38 lines
1.1 KiB
Python
Raw Normal View History

"""City -> tax jurisdiction mapping for the countdown solver."""
from __future__ import annotations
import pytest
from fire_planner.geo import jurisdiction_for_city
@pytest.mark.parametrize(
("slug", "expected"),
[
("sofia", "bulgaria"),
("limassol", "cyprus"),
("bangkok", "thailand"),
("chiang-mai", "thailand"),
("kuala-lumpur", "malaysia"),
("penang", "malaysia"),
("dubai", "uae"),
("london", "uk"),
],
)
def test_known_cities_map_to_their_regime(slug: str, expected: str) -> None:
assert jurisdiction_for_city(slug) == expected
@pytest.mark.parametrize("slug", ["lisbon", "porto", "athens", "tbilisi", "atlantis", ""])
def test_unmapped_cities_fall_back_to_nomad(slug: str) -> None:
assert jurisdiction_for_city(slug) == "nomad"
def test_mapping_only_uses_regimes_the_engine_knows() -> None:
from fire_planner.geo import CITY_JURISDICTION
from fire_planner.scenarios import _JURISDICTION_CONSTRUCTORS
known = set(_JURISDICTION_CONSTRUCTORS)
assert set(CITY_JURISDICTION.values()) <= known
assert "nomad" in known