diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f2a444..d8b55ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Fixed - Do not mistake "océan indien" as IN +- Support for Saint-Martin (France) postcodes ### Dependencies diff --git a/geoconvert/convert.py b/geoconvert/convert.py index 3ae2cf0..d66c9c5 100644 --- a/geoconvert/convert.py +++ b/geoconvert/convert.py @@ -281,6 +281,10 @@ def fr_postcode_to_dept_code(text): else: return "20B" + # Saint-Martin + if postcode[:3] == "970": + return "971" + # Other cases for code in (postcode[:2], postcode[:3]): if code in fr_departments.values(): diff --git a/tests/test_subdivisions/test_france.py b/tests/test_subdivisions/test_france.py index d92fb58..cab4b88 100644 --- a/tests/test_subdivisions/test_france.py +++ b/tests/test_subdivisions/test_france.py @@ -172,6 +172,10 @@ def test_fr_address_to_dept_code(self, input_data, expected): ("Rue de la Réunion, 75000 Paris", "75"), ("Rue de l'Orne, 44800 Saint-Herblain", "44"), ("D7, Sainte-Luce 97228, Martinique", "972"), + # Saint-Martin postcodes + ("Code postal 97150", "971"), + ("Code postal 97051", "971"), + ("Code postal 97080", "971"), ("99999", None), ], )