diff --git a/CHANGELOG.md b/CHANGELOG.md index f28a7a4..623a39a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - All tests pass, no warning - Detection for "Congo Democratic Republic" as CG (without "of" in the end) - Do not mistake "Haute-Vienne" French department with the Austrian capital name "Vienne" (in French) +- Do not mistake "Prince Edward Island" (Canadian province) and "Rhode Island" (US state) + with Iceland (which spells Island in German). ### Upgrade diff --git a/geoconvert/data/countries.py b/geoconvert/data/countries.py index 405e5b7..6206d5d 100644 --- a/geoconvert/data/countries.py +++ b/geoconvert/data/countries.py @@ -32,8 +32,10 @@ "south sudan": "SS", # en "sudsudan": "SS", # de "sudan del sur": "SS", # es - # Make sure we never mistake some countries for IS (Iceland) + # Make sure we never mistake some countries or subdivisions for IS (Iceland) # We would mistake them because Iceland spells Island in German. + "prince edward island": "CA", # en + "rhode island": "US", # en "bouvet island": "BV", # en "christmas island": "CX", # en "heard island": "HM", # en diff --git a/tests/test_countries.py b/tests/test_countries.py index d9e52df..79cd848 100644 --- a/tests/test_countries.py +++ b/tests/test_countries.py @@ -57,6 +57,8 @@ class TestCountries: ("Heard Island", {}, "HM"), # en ("Norfolk Island", {}, "NF"), # en ("Solomon Islands", {}, "SB"), # en + ("Prince Edward Island", {}, "CA"), # en + ("Rhode Island", {}, "US"), # en # However, in cases where island is singular instead of plural, # there can be confusion. ("Solomon Island Nationals", {}, "IS"), # en diff --git a/tests/test_subdivisions/test_subdivisions_without_countries.py b/tests/test_subdivisions/test_subdivisions_without_countries.py index fc6f3a1..dad2ff4 100644 --- a/tests/test_subdivisions/test_subdivisions_without_countries.py +++ b/tests/test_subdivisions/test_subdivisions_without_countries.py @@ -48,6 +48,9 @@ class TestNoCountryProvided: ("2 pl. Saint-Pierre, 44000 Nantes", {"country": "FR"}, "44"), ("2 pl. Saint-Pierre, 44000 Nantes, France", {}, "44"), ("2 pl. Saint-Pierre, 44000 Nantes, France", {"country": "FR"}, "44"), + # No mistakes with Iceland (IS) + ("Prince Edward Island", {}, "PE"), + ("Rhode Island", {}, "RI"), ], ) def test_address_to_subdivision_code(self, input_data, kwargs, expected): @@ -95,6 +98,9 @@ def test_address_to_subdivision_code(self, input_data, kwargs, expected): {}, ("AT", None), # Precedence goes to the French capital name for Austria ), + # No mistakes with Iceland (IS) + ("Prince Edward Island", {}, ("CA", "PE")), + ("Rhode Island", {}, ("US", "RI")), ], ) def test_address_to_country_and_subdivision_code(