Skip to content

Commit

Permalink
Better BA detection and avoid confusing some countries with IS
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoriniere committed Mar 15, 2022
1 parent a68e3e0 commit 45aa814
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [4.5.2] - 2022-03-15

### Added

- Detection for "Bosnia & Herzegovina" as "BA" in English

### Fixed

- No longer find "IS" for countries with "island" in their names.

## [4.5.1] - 2022-03-11

Expand Down
2 changes: 1 addition & 1 deletion geoconvert/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__author__ = "Jurismarches <[email protected]>"
__version__ = "4.5.0"
__version__ = "4.5.2"
7 changes: 7 additions & 0 deletions geoconvert/data/countries.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
"south sudan": "SS", # en
"sudsudan": "SS", # de
"sudan del sur": "SS", # es
# Make sure we never mistake some countries for IS (Iceland)
# We would mistake them because Iceland spells Island in German.
"bouvet island": "BV", # en
"christmas island": "CX", # en
"heard island": "HM", # en
"norfolk island": "NF", # en
}


Expand Down Expand Up @@ -334,6 +340,7 @@
"bolivia plurinational state of": "BO",
"bonaire saint eustatius and saba": "BQ",
"bosnia and herzegovina": "BA",
"bosnia & herzegovina": "BA",
"botswana": "BW",
"bouvet island": "BV",
"brazil": "BR",
Expand Down
10 changes: 10 additions & 0 deletions tests/test_countries.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ class TestCountries:
("sudan del sur", {}, "SS"), # es
("Soudan du Sud", {}, "SS"), # fr
("sudao do sul", {}, "SS"), # pt
# No confusion with Iceland, which spells "Island" in German ("IS")
("Cayman islands", {}, "KY"), # en
("Christmas island", {}, "CX"), #en
("Bouvet Island", {}, "BV"), # en
("Heard Island", {}, "HM"), # en
("Norfolk Island", {}, "NF"), # en
("Solomon Islands", {}, "SB"), # en
# However, in cases where island is singular instead of plural,
# there can be confusion.
("Solomon Island Nationals", {}, "IS"), # en
# Any capitalization for lang works
("Germany", {"lang": "en"}, "DE"),
("Germany", {"lang": "En"}, "DE"),
Expand Down

0 comments on commit 45aa814

Please sign in to comment.