Skip to content

Commit

Permalink
[countries] papua new guinea improve special_countries (#20)
Browse files Browse the repository at this point in the history
* [countries] papua new guinea improve special_countries

* more tests

Co-authored-by: maylis baschet <[email protected]>
  • Loading branch information
MayBaMay and maylis baschet authored Sep 23, 2021
1 parent e052ebb commit 71672aa
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
28 changes: 12 additions & 16 deletions geoconvert/data/countries.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@
"republik kongo": "CG", # de
"republica do congo": "CG", # pt
"congo": "CG", # en, fr
# Make sure we never mistake it for SD
# Make sure we never mistake it for GN (Guinea)
"aquatorialguinea": "GQ", # es
"equatorial guinea": "GQ", # de / en
"guinea bissau": "GW", # en / de
"guinea ecuatorial": "GQ", # es
"pap new guinea": "PG", # en
"papua neuguinea": "PG", # de
"papua new guinea": "PG", # en
"papua nueva guinea": "PG", # es
# Make sure we never mistake it for JE (Jersey)
"new jersey": "US",
# Make sure we never mistake it for SD (Sudan)
"south sudan": "SS", # en
"sudsudan": "SS", # de
"sudan del sur": "SS", # es
# Make sure we never mistake it for JE
"new jersey": "US",
# Make sure we never mistake it for GN
"papua new guinea": "PG"
}


Expand Down Expand Up @@ -126,7 +133,6 @@
"guinee": "GN",
"guinee bissau": "GW",
"guinee equatoriale": "GQ",
"guinee bissau": "GW",
"guyana": "GY",
"guyane francaise": "GF",
"haiti": "HT",
Expand Down Expand Up @@ -366,7 +372,6 @@
"ecuador": "EC",
"egypt": "EG",
"el salvador": "SV",
"equatorial guinea": "GQ",
"eritrea": "ER",
"estonia": "EE",
"eswatini": "SZ",
Expand All @@ -393,7 +398,6 @@
"guatemala": "GT",
"guernsey": "GG",
"guinea": "GN",
"guinea bissau": "GW",
"guyana": "GY",
"haiti": "HT",
"heard island": "HM",
Expand Down Expand Up @@ -482,8 +486,6 @@
"palestinian territories": "PS",
"west bank": "PS",
"panama": "PA",
"pap new guinea": "PG",
"papua new guinea": "PG",
"paraguay": "PY",
"peru": "PE",
"philippines": "PH",
Expand Down Expand Up @@ -579,7 +581,6 @@
**special_countries,
**{
"agypten": "EG",
"aquatorialguinea": "GQ",
"athiopien": "ET",
"afghanistan": "AF",
"albanien": "AL",
Expand Down Expand Up @@ -631,7 +632,6 @@
"griechenland": "GR",
"guatemala": "GT",
"guinea": "GN",
"guinea bissau": "GW",
"guyana": "GY",
"haiti": "HT",
"honduras": "HN",
Expand Down Expand Up @@ -707,7 +707,6 @@
"palastina": "PS",
"palau": "PW",
"panama": "PA",
"papua neuguinea": "PG",
"paraguay": "PY",
"peru": "PE",
"philippinen": "PH",
Expand Down Expand Up @@ -1133,9 +1132,7 @@
"guernsey": "GG",
"guayana": "GY",
"guayana francesa": "GF",
"guinea bissau": "GW",
"guinea": "GN",
"guinea ecuatorial": "GQ",
"haiti": "HT",
"islas heard y mcdonald": "HM",
"heard y mcdonald": "HM",
Expand Down Expand Up @@ -1211,7 +1208,6 @@
"palaos": "PW",
"palestina": "PS",
"panama": "PA",
"papua nueva guinea": "PG",
"pakistan": "PK",
"paraguay": "PY",
"peru": "PE",
Expand Down
28 changes: 27 additions & 1 deletion test_geoconvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,34 @@ def test_fr_region_name_to_info(self, input_data, expected):
# If no country found, return None
("Wonderland", {}, None),
("Germany", {"lang": "fr"}, None),
# No confusion with Congo
# No confusion with Congo ("CD")
("Congo (Brazzaville)", {}, "CG"),
("Congo (Kinshasa)", {}, "CD"),
("Congo", {}, "CG"),
# No confusion with Guinea ("GN")
# "GQ"
("equatorial guinea", {}, "GQ"), # de / en
("aquatorialguinea", {}, "GQ"), # es
("guinee equatoriale", {}, "GQ"), #fr
("guine equatorial", {}, "GQ"), # pt
# "PG"
("papua neuguinea", {}, "PG"), # de
("pap new guinea", {}, "PG"), # en
("papua nueva guinea", {}, "PG"), # es
("papouasie nouvelle guinee", {}, "PG"), # fr
("papua nova guine", {}, "PG"), # pt
# "GW"
("guinea bissau", {}, "GW"), # de / en / es
("guinee bissau", {}, "GW"), # fr
("guine bissau", {}, "GW"), # pt
# No confusion with Jersey ("JE")
("new jersey", {}, "US"),
# No confusion with Sudan ("SD")
("sudsudan", {}, "SS"), # de
("south sudan", {}, "SS"), # en
("sudan del sur", {}, "SS"), # es
("Soudan du Sud", {}, "SS"), # fr
("sudao do sul", {}, "SS"), # pt
# Any capitalization for lang works
("Germany", {"lang": "en"}, "DE"),
("Germany", {"lang": "En"}, "DE"),
Expand Down Expand Up @@ -531,6 +555,7 @@ def test_country_name_to_country_code(self, input_data, kwargs, expected):
("Congo (Brazzaville)", "CG"),
("Congo (Kinshasa)", "CD"),
("São tome & principe ", "ST"),
("Papouasie Nouvelle Guinée", "PG"),
],
)
def test_country_name_to_country_code_fr(self, input_data, expected):
Expand Down Expand Up @@ -623,6 +648,7 @@ def test_country_name_to_country_code_de(self, input_data, expected):
("o país do peru", "PE"),
(u"País de execução: Polónia", "PL"),
("São Vicente e Granadinas ", "VC"),
("Guine bissau", "GW"),
],
)
def test_country_name_to_country_code_pt(self, input_data, expected):
Expand Down

0 comments on commit 71672aa

Please sign in to comment.