hdx-python-country 3.7.3__tar.gz → 3.7.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/PKG-INFO +2 -2
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/pyproject.toml +1 -1
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/requirements.txt +9 -7
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/src/hdx/location/_version.py +2 -2
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/src/hdx/location/adminlevel.py +8 -12
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/src/hdx/location/names.py +1 -3
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/src/hdx/location/phonetics.py +10 -10
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/fixtures/adminlevel.yaml +0 -1
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/fixtures/adminlevelparent.yaml +3 -4
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/hdx/location/test_adminlevel.py +29 -48
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/.config/coveragerc +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/.config/pre-commit-config.yaml +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/.config/pytest.ini +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/.config/ruff.toml +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/.github/workflows/publish.yaml +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/.github/workflows/run-python-tests.yaml +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/.gitignore +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/CONTRIBUTING.md +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/LICENSE +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/README.md +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/documentation/.readthedocs.yaml +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/documentation/main.md +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/documentation/pydoc-markdown.yaml +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/src/hdx/location/Countries & Territories Taxonomy MVP - C&T Taxonomy with HXL Tags.csv +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/src/hdx/location/__init__.py +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/src/hdx/location/country.py +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/src/hdx/location/currency.py +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/src/hdx/location/wfp_exchangerates.py +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/fixtures/global_pcode_lengths.csv +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/fixtures/global_pcodes_adm_1_2.csv +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/fixtures/secondary_historic_rates.csv +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/fixtures/secondary_rates.json +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/hdx/location/Countries_UZB_Deleted.csv +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/hdx/location/__init__.py +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/hdx/location/test_country.py +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/hdx/location/test_currency.py +0 -0
- {hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/hdx/location/test_wfp_exchangerates.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: hdx-python-country
|
|
3
|
-
Version: 3.7.
|
|
3
|
+
Version: 3.7.4
|
|
4
4
|
Summary: HDX Python country code and exchange rate (fx) utilities
|
|
5
5
|
Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-country
|
|
6
6
|
Author: Michael Rans
|
|
@@ -27,7 +27,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
27
27
|
Requires-Python: >=3.8
|
|
28
28
|
Requires-Dist: hdx-python-utilities>=3.7.0
|
|
29
29
|
Requires-Dist: libhxl>=5.2.1
|
|
30
|
-
Requires-Dist:
|
|
30
|
+
Requires-Dist: pyphonetics
|
|
31
31
|
Provides-Extra: dev
|
|
32
32
|
Requires-Dist: pre-commit; extra == 'dev'
|
|
33
33
|
Provides-Extra: test
|
|
@@ -18,13 +18,13 @@ charset-normalizer==3.3.2
|
|
|
18
18
|
# via requests
|
|
19
19
|
click==8.1.7
|
|
20
20
|
# via typer
|
|
21
|
-
coverage==7.5.
|
|
21
|
+
coverage==7.5.4
|
|
22
22
|
# via pytest-cov
|
|
23
23
|
distlib==0.3.8
|
|
24
24
|
# via virtualenv
|
|
25
25
|
et-xmlfile==1.1.0
|
|
26
26
|
# via openpyxl
|
|
27
|
-
filelock==3.15.
|
|
27
|
+
filelock==3.15.4
|
|
28
28
|
# via virtualenv
|
|
29
29
|
frictionless==5.17.0
|
|
30
30
|
# via hdx-python-utilities
|
|
@@ -60,7 +60,7 @@ loguru==0.7.2
|
|
|
60
60
|
# via hdx-python-utilities
|
|
61
61
|
markdown-it-py==3.0.0
|
|
62
62
|
# via rich
|
|
63
|
-
marko==2.1.
|
|
63
|
+
marko==2.1.2
|
|
64
64
|
# via frictionless
|
|
65
65
|
markupsafe==2.1.5
|
|
66
66
|
# via jinja2
|
|
@@ -90,6 +90,8 @@ pydantic-core==2.18.4
|
|
|
90
90
|
# via pydantic
|
|
91
91
|
pygments==2.18.0
|
|
92
92
|
# via rich
|
|
93
|
+
pyphonetics==0.5.3
|
|
94
|
+
# via hdx-python-country (pyproject.toml)
|
|
93
95
|
pytest==8.2.2
|
|
94
96
|
# via
|
|
95
97
|
# hdx-python-country (pyproject.toml)
|
|
@@ -110,8 +112,6 @@ pyyaml==6.0.1
|
|
|
110
112
|
# frictionless
|
|
111
113
|
# pre-commit
|
|
112
114
|
# tableschema-to-template
|
|
113
|
-
rapidfuzz==3.9.3
|
|
114
|
-
# via hdx-python-country (pyproject.toml)
|
|
115
115
|
ratelimit==2.2.1
|
|
116
116
|
# via hdx-python-utilities
|
|
117
117
|
referencing==0.35.1
|
|
@@ -164,14 +164,16 @@ typing-extensions==4.12.2
|
|
|
164
164
|
# pydantic-core
|
|
165
165
|
# typer
|
|
166
166
|
unidecode==1.3.8
|
|
167
|
-
# via
|
|
167
|
+
# via
|
|
168
|
+
# libhxl
|
|
169
|
+
# pyphonetics
|
|
168
170
|
urllib3==2.2.2
|
|
169
171
|
# via
|
|
170
172
|
# libhxl
|
|
171
173
|
# requests
|
|
172
174
|
validators==0.28.3
|
|
173
175
|
# via frictionless
|
|
174
|
-
virtualenv==20.26.
|
|
176
|
+
virtualenv==20.26.3
|
|
175
177
|
# via pre-commit
|
|
176
178
|
wheel==0.43.0
|
|
177
179
|
# via libhxl
|
|
@@ -5,6 +5,7 @@ from typing import Any, Dict, List, Optional, Tuple
|
|
|
5
5
|
import hxl
|
|
6
6
|
from hxl import InputOptions
|
|
7
7
|
from hxl.input import HXLIOException
|
|
8
|
+
from unidecode import unidecode
|
|
8
9
|
|
|
9
10
|
from hdx.location.country import Country
|
|
10
11
|
from hdx.location.names import clean_name
|
|
@@ -146,7 +147,7 @@ class AdminLevel:
|
|
|
146
147
|
self.pcode_to_name[pcode] = adm_name
|
|
147
148
|
|
|
148
149
|
name_to_pcode = self.name_to_pcode.get(countryiso3, {})
|
|
149
|
-
name_to_pcode[
|
|
150
|
+
name_to_pcode[unidecode(adm_name).lower()] = pcode
|
|
150
151
|
self.name_to_pcode[countryiso3] = name_to_pcode
|
|
151
152
|
self.pcode_to_iso3[pcode] = countryiso3
|
|
152
153
|
self.pcode_to_iso3[pcode] = countryiso3
|
|
@@ -156,7 +157,7 @@ class AdminLevel:
|
|
|
156
157
|
countryiso3, {}
|
|
157
158
|
)
|
|
158
159
|
name_to_pcode = name_parent_to_pcode.get(parent, {})
|
|
159
|
-
name_to_pcode[
|
|
160
|
+
name_to_pcode[unidecode(adm_name).lower()] = pcode
|
|
160
161
|
name_parent_to_pcode[parent] = name_to_pcode
|
|
161
162
|
self.name_parent_to_pcode[countryiso3] = name_parent_to_pcode
|
|
162
163
|
self.pcode_to_parent[pcode] = parent
|
|
@@ -641,25 +642,22 @@ class AdminLevel:
|
|
|
641
642
|
break
|
|
642
643
|
if not pcode:
|
|
643
644
|
map_names = list(name_to_pcode.keys())
|
|
645
|
+
lower_mapnames = [x.lower() for x in map_names]
|
|
644
646
|
|
|
645
647
|
def al_transform_1(name):
|
|
646
|
-
|
|
647
|
-
if prefix == "al ":
|
|
648
|
+
if name[:3] == "al ":
|
|
648
649
|
return f"ad {name[3:]}"
|
|
649
|
-
elif prefix == "ad ":
|
|
650
|
-
return f"al {name[3:]}"
|
|
651
650
|
else:
|
|
652
651
|
return None
|
|
653
652
|
|
|
654
653
|
def al_transform_2(name):
|
|
655
|
-
|
|
656
|
-
if prefix == "al " or prefix == "ad ":
|
|
654
|
+
if name[:3] == "al ":
|
|
657
655
|
return name[3:]
|
|
658
656
|
else:
|
|
659
657
|
return None
|
|
660
658
|
|
|
661
659
|
matching_index = self.phonetics.match(
|
|
662
|
-
|
|
660
|
+
lower_mapnames,
|
|
663
661
|
adm_name_lookup,
|
|
664
662
|
alternative_name=adm_name_lookup2,
|
|
665
663
|
transform_possible_names=[al_transform_1, al_transform_2],
|
|
@@ -716,7 +714,6 @@ class AdminLevel:
|
|
|
716
714
|
countryiso3: str,
|
|
717
715
|
name: str,
|
|
718
716
|
fuzzy_match: bool = True,
|
|
719
|
-
fuzzy_length: int = 4,
|
|
720
717
|
**kwargs: Any,
|
|
721
718
|
) -> Tuple[Optional[str], bool]:
|
|
722
719
|
"""Get pcode for a given name
|
|
@@ -725,7 +722,6 @@ class AdminLevel:
|
|
|
725
722
|
countryiso3 (str): ISO3 country code
|
|
726
723
|
name (str): Name to match
|
|
727
724
|
fuzzy_match (bool): Whether to try fuzzy matching. Defaults to True.
|
|
728
|
-
fuzzy_length (int): Minimum length for fuzzy matching. Defaults to 4.
|
|
729
725
|
**kwargs:
|
|
730
726
|
parent (Optional[str]): Parent admin code
|
|
731
727
|
logname (str): Log using this identifying name. Defaults to not logging.
|
|
@@ -771,7 +767,7 @@ class AdminLevel:
|
|
|
771
767
|
pcode = name_to_pcode.get(name.lower())
|
|
772
768
|
if pcode:
|
|
773
769
|
return pcode, True
|
|
774
|
-
if not fuzzy_match
|
|
770
|
+
if not fuzzy_match:
|
|
775
771
|
return None, True
|
|
776
772
|
pcode = self.fuzzy_pcode(countryiso3, name, **kwargs)
|
|
777
773
|
return pcode, False
|
|
@@ -3,7 +3,7 @@ import unicodedata
|
|
|
3
3
|
|
|
4
4
|
from unidecode import unidecode
|
|
5
5
|
|
|
6
|
-
non_ascii =
|
|
6
|
+
non_ascii = "([^\x00-\x7f])+"
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def clean_name(name: str) -> str:
|
|
@@ -25,7 +25,5 @@ def clean_name(name: str) -> str:
|
|
|
25
25
|
)
|
|
26
26
|
# Remove all non-ASCII characters
|
|
27
27
|
clean_name = re.sub(non_ascii, " ", clean_name)
|
|
28
|
-
clean_name = clean_name.replace("'", "")
|
|
29
|
-
clean_name = re.sub(r"[\W_]", " ", clean_name)
|
|
30
28
|
clean_name = unidecode(clean_name)
|
|
31
29
|
return clean_name.strip().lower()
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
from typing import Callable, Optional
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import pyphonetics
|
|
4
4
|
|
|
5
5
|
from hdx.utilities.typehint import ListTuple
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class Phonetics:
|
|
8
|
+
class Phonetics(pyphonetics.RefinedSoundex):
|
|
9
9
|
def match(
|
|
10
10
|
self,
|
|
11
11
|
possible_names: ListTuple,
|
|
12
12
|
name: str,
|
|
13
13
|
alternative_name: Optional[str] = None,
|
|
14
14
|
transform_possible_names: ListTuple[Callable] = [],
|
|
15
|
-
threshold:
|
|
15
|
+
threshold: int = 2,
|
|
16
16
|
) -> Optional[int]:
|
|
17
17
|
"""
|
|
18
18
|
Match name to one of the given possible names. Returns None if no match
|
|
@@ -23,22 +23,22 @@ class Phonetics:
|
|
|
23
23
|
name (str): Name to match
|
|
24
24
|
alternative_name (str): Alternative name to match. Defaults to None.
|
|
25
25
|
transform_possible_names (ListTuple[Callable]): Functions to transform possible names.
|
|
26
|
-
threshold
|
|
26
|
+
threshold: Match threshold. Defaults to 2.
|
|
27
27
|
|
|
28
28
|
Returns:
|
|
29
29
|
Optional[int]: Index of matching name from possible names or None
|
|
30
30
|
"""
|
|
31
|
-
|
|
31
|
+
mindistance = None
|
|
32
32
|
matching_index = None
|
|
33
33
|
|
|
34
34
|
transform_possible_names.insert(0, lambda x: x)
|
|
35
35
|
|
|
36
36
|
def check_name(name, possible_name):
|
|
37
|
-
nonlocal
|
|
37
|
+
nonlocal mindistance, matching_index # noqa: E999
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
if
|
|
41
|
-
|
|
39
|
+
distance = self.distance(name, possible_name)
|
|
40
|
+
if mindistance is None or distance < mindistance:
|
|
41
|
+
mindistance = distance
|
|
42
42
|
matching_index = i
|
|
43
43
|
|
|
44
44
|
for i, possible_name in enumerate(possible_names):
|
|
@@ -51,6 +51,6 @@ class Phonetics:
|
|
|
51
51
|
check_name(name, transformed_possible_name)
|
|
52
52
|
if alternative_name:
|
|
53
53
|
check_name(alternative_name, transformed_possible_name)
|
|
54
|
-
if
|
|
54
|
+
if mindistance is None or mindistance > threshold:
|
|
55
55
|
return None
|
|
56
56
|
return matching_index
|
|
@@ -16,11 +16,10 @@ admin_name_mappings:
|
|
|
16
16
|
"AF05|MyMapping3": "AF0501"
|
|
17
17
|
|
|
18
18
|
admin_name_replacements:
|
|
19
|
-
"
|
|
19
|
+
" city": ""
|
|
20
20
|
|
|
21
21
|
alt1_admin_name_replacements:
|
|
22
|
-
"COD|
|
|
22
|
+
"COD| city": ""
|
|
23
23
|
|
|
24
24
|
alt2_admin_name_replacements:
|
|
25
|
-
"CD20|
|
|
26
|
-
"CD31|wx": "en"
|
|
25
|
+
"CD20| city": ""
|
|
@@ -182,10 +182,6 @@ class TestAdminLevel:
|
|
|
182
182
|
def test_adminlevel_fuzzy(self, config):
|
|
183
183
|
adminone = AdminLevel(config)
|
|
184
184
|
adminone.setup_from_admin_info(config["admin_info"])
|
|
185
|
-
assert adminone.get_pcode("YEM", "Al_Dhale'a", logname="test") == (
|
|
186
|
-
"YE30",
|
|
187
|
-
False,
|
|
188
|
-
)
|
|
189
185
|
assert adminone.get_pcode("YEM", "Al Dali", logname="test") == (
|
|
190
186
|
"YE30",
|
|
191
187
|
False,
|
|
@@ -196,24 +192,14 @@ class TestAdminLevel:
|
|
|
196
192
|
"YE30",
|
|
197
193
|
False,
|
|
198
194
|
)
|
|
199
|
-
assert adminone.get_pcode("YEM", "Ad Jauf", logname="test") == (
|
|
200
|
-
"YE16",
|
|
201
|
-
False,
|
|
202
|
-
)
|
|
203
|
-
assert adminone.get_pcode("AFG", "Sar-E-Pul", logname="test") == (
|
|
204
|
-
"AF22",
|
|
205
|
-
False,
|
|
206
|
-
)
|
|
207
195
|
assert adminone.get_pcode("SOM", "Bay", logname="test") == (
|
|
208
196
|
"SO24",
|
|
209
197
|
True,
|
|
210
198
|
)
|
|
211
199
|
output = adminone.output_matches()
|
|
212
200
|
assert output == [
|
|
213
|
-
"test - YEM: Matching (fuzzy) Ad Jauf to Al Jawf on map",
|
|
214
201
|
"test - YEM: Matching (fuzzy) Al Dali to Ad Dali on map",
|
|
215
202
|
"test - YEM: Matching (fuzzy) Al Dhale'e / الضالع to Ad Dali on map",
|
|
216
|
-
"test - YEM: Matching (fuzzy) Al_Dhale'a to Ad Dali on map",
|
|
217
203
|
]
|
|
218
204
|
|
|
219
205
|
def test_adminlevel_parent(self, config_parent):
|
|
@@ -295,19 +281,21 @@ class TestAdminLevel:
|
|
|
295
281
|
) == (None, False)
|
|
296
282
|
|
|
297
283
|
output = admintwo.output_admin_name_replacements()
|
|
298
|
-
assert output == ["
|
|
284
|
+
assert output == [" city: "]
|
|
299
285
|
assert admintwo.get_pcode(
|
|
300
|
-
"COD", "
|
|
286
|
+
"COD", "Mbanza-Ngungu city", logname="test"
|
|
301
287
|
) == ("CD2013", False)
|
|
302
288
|
assert admintwo.get_pcode(
|
|
303
|
-
"COD", "
|
|
289
|
+
"COD", "Mbanza-Ngungu city", parent="CD20", logname="test"
|
|
304
290
|
) == ("CD2013", False)
|
|
305
291
|
assert admintwo.get_pcode(
|
|
306
|
-
"COD", "
|
|
292
|
+
"COD", "Mbanza-Ngungu city", parent="CD19", logname="test"
|
|
307
293
|
) == (None, False)
|
|
308
|
-
assert admintwo.get_pcode(
|
|
309
|
-
"
|
|
310
|
-
|
|
294
|
+
assert admintwo.get_pcode("COD", "Kenge city", logname="test") == (
|
|
295
|
+
"CD3102",
|
|
296
|
+
False,
|
|
297
|
+
)
|
|
298
|
+
assert admintwo.get_pcode("MWI", "Blantyre city", logname="test") == (
|
|
311
299
|
"MW305",
|
|
312
300
|
False,
|
|
313
301
|
)
|
|
@@ -316,66 +304,58 @@ class TestAdminLevel:
|
|
|
316
304
|
"alt1_admin_name_replacements"
|
|
317
305
|
]
|
|
318
306
|
output = admintwo.output_admin_name_replacements()
|
|
319
|
-
assert output == ["COD|
|
|
307
|
+
assert output == ["COD| city: "]
|
|
320
308
|
assert admintwo.get_pcode(
|
|
321
|
-
"COD", "
|
|
309
|
+
"COD", "Mbanza-Ngungu city", logname="test"
|
|
322
310
|
) == ("CD2013", False)
|
|
323
311
|
assert admintwo.get_pcode(
|
|
324
|
-
"COD", "
|
|
312
|
+
"COD", "Mbanza-Ngungu city", parent="CD20", logname="test"
|
|
325
313
|
) == ("CD2013", False)
|
|
326
314
|
assert admintwo.get_pcode(
|
|
327
|
-
"COD", "
|
|
315
|
+
"COD", "Mbanza-Ngungu city", parent="CD19", logname="test"
|
|
328
316
|
) == (None, False)
|
|
329
|
-
assert admintwo.get_pcode("COD", "Kenge
|
|
317
|
+
assert admintwo.get_pcode("COD", "Kenge city", logname="test") == (
|
|
330
318
|
"CD3102",
|
|
331
319
|
False,
|
|
332
320
|
)
|
|
333
|
-
assert admintwo.get_pcode("COD", "Kwxge City", logname="test") == (
|
|
334
|
-
None,
|
|
335
|
-
False,
|
|
336
|
-
)
|
|
337
|
-
assert admintwo.get_pcode(
|
|
338
|
-
"COD", "Kwxge City", parent="CD31", logname="test"
|
|
339
|
-
) == (None, False)
|
|
340
321
|
assert admintwo.get_pcode(
|
|
341
|
-
"
|
|
342
|
-
) == (
|
|
322
|
+
"COD", "Kenge city", parent="CD31", logname="test"
|
|
323
|
+
) == ("CD3102", False)
|
|
324
|
+
assert admintwo.get_pcode("MWI", "Blantyre city", logname="test") == (
|
|
343
325
|
None,
|
|
344
326
|
False,
|
|
345
327
|
)
|
|
346
328
|
assert admintwo.get_pcode(
|
|
347
|
-
"MWI", "
|
|
329
|
+
"MWI", "Blantyre city", parent="MW3", logname="test"
|
|
348
330
|
) == (None, False)
|
|
349
331
|
|
|
350
332
|
admintwo.admin_name_replacements = config_parent[
|
|
351
333
|
"alt2_admin_name_replacements"
|
|
352
334
|
]
|
|
353
335
|
output = admintwo.output_admin_name_replacements()
|
|
354
|
-
assert output == ["CD20|
|
|
336
|
+
assert output == ["CD20| city: "]
|
|
355
337
|
assert admintwo.get_pcode(
|
|
356
|
-
"COD", "
|
|
338
|
+
"COD", "Mbanza-Ngungu city", logname="test"
|
|
357
339
|
) == (None, False)
|
|
358
340
|
assert admintwo.get_pcode(
|
|
359
|
-
"COD", "
|
|
341
|
+
"COD", "Mbanza-Ngungu city", parent="CD20", logname="test"
|
|
360
342
|
) == ("CD2013", False)
|
|
361
343
|
assert admintwo.get_pcode(
|
|
362
|
-
"COD", "
|
|
344
|
+
"COD", "Mbanza-Ngungu city", parent="CD19", logname="test"
|
|
363
345
|
) == (None, False)
|
|
364
|
-
assert admintwo.get_pcode("COD", "
|
|
346
|
+
assert admintwo.get_pcode("COD", "Kenge city", logname="test") == (
|
|
365
347
|
None,
|
|
366
348
|
False,
|
|
367
349
|
)
|
|
368
350
|
assert admintwo.get_pcode(
|
|
369
|
-
"COD", "
|
|
370
|
-
) == (
|
|
371
|
-
assert admintwo.get_pcode(
|
|
372
|
-
"MWI", "City of Blwxtyre", logname="test"
|
|
373
|
-
) == (
|
|
351
|
+
"COD", "Kenge city", parent="CD31", logname="test"
|
|
352
|
+
) == (None, False)
|
|
353
|
+
assert admintwo.get_pcode("MWI", "Blantyre city", logname="test") == (
|
|
374
354
|
None,
|
|
375
355
|
False,
|
|
376
356
|
)
|
|
377
357
|
assert admintwo.get_pcode(
|
|
378
|
-
"MWI", "
|
|
358
|
+
"MWI", "Blantyre city", parent="MW3", logname="test"
|
|
379
359
|
) == (None, False)
|
|
380
360
|
|
|
381
361
|
def test_adminlevel_with_url(self, config, url):
|
|
@@ -477,7 +457,7 @@ class TestAdminLevel:
|
|
|
477
457
|
)
|
|
478
458
|
assert adminone.get_pcode("YEM", "Ad Dali", logname="test") == (
|
|
479
459
|
"YE30",
|
|
480
|
-
|
|
460
|
+
False,
|
|
481
461
|
)
|
|
482
462
|
assert adminone.get_pcode("YEM", "Ad Dal", logname="test") == (
|
|
483
463
|
"YE30",
|
|
@@ -520,6 +500,7 @@ class TestAdminLevel:
|
|
|
520
500
|
"test - NGA: Matching (pcode length conversion) NG015 to Federal Capital Territory on map",
|
|
521
501
|
"test - UKR: Matching (substring) Chernihiv Oblast to Chernihivska on map",
|
|
522
502
|
"test - YEM: Matching (substring) Ad Dal to Ad Dali' on map",
|
|
503
|
+
"test - YEM: Matching (substring) Ad Dali to Ad Dali' on map",
|
|
523
504
|
"test - YEM: Matching (pcode length conversion) YE30 to Ad Dali' on map",
|
|
524
505
|
]
|
|
525
506
|
output = adminone.output_ignored()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/.github/workflows/run-python-tests.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/fixtures/global_pcode_lengths.csv
RENAMED
|
File without changes
|
{hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/fixtures/global_pcodes_adm_1_2.csv
RENAMED
|
File without changes
|
{hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/fixtures/secondary_historic_rates.csv
RENAMED
|
File without changes
|
|
File without changes
|
{hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/hdx/location/Countries_UZB_Deleted.csv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_country-3.7.3 → hdx_python_country-3.7.4}/tests/hdx/location/test_wfp_exchangerates.py
RENAMED
|
File without changes
|