Skip to content

Commit

Permalink
handle upper-case
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdicaprio committed Nov 19, 2024
1 parent e76f68f commit 96235b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nzshm_common/location/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,17 @@ def _get_macron_name_mapping() -> Dict[str, str]:
"""using the maori_names.csv file as received from LINZ rather than storing the mapping allows
us to update without rebuilding the resource"""

char_map = {
char_map_lower = {
'ā': 'a',
'ē': 'e',
'ī': 'i',
'ō': 'o',
'ū': 'u',
}
char_map = {}
for k, v in char_map_lower.items():
char_map[k] = v
char_map[k.upper()] = v.upper()

name_mapping = dict()
with resources.as_file(resource_dir / 'maori_names.csv') as path:
Expand Down
1 change: 1 addition & 0 deletions tests/test_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def test_missing_lat_lon_returns_None():
@pytest.mark.parametrize(
"name_in,name_out",
[
("Otaki", "Ōtaki"), # should work with capital letters
("Hamama", "Hāmama"),
("Kerepēhi", "Kerepēhi"),
("Ahitītī", "Ahitītī"),
Expand Down

0 comments on commit 96235b0

Please sign in to comment.