Skip to content

Commit

Permalink
add support for Saint-Martin (France) postcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Roxane committed Feb 6, 2024
1 parent 35ea160 commit fcd2ac7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions geoconvert/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 4 additions & 0 deletions tests/test_subdivisions/test_france.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
],
)
Expand Down

0 comments on commit fcd2ac7

Please sign in to comment.