mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
add tests for new full name computation with ICU
This commit is contained in:
@@ -537,8 +537,6 @@ class _TokenInfo:
|
|||||||
"""
|
"""
|
||||||
# Start with all partial names
|
# Start with all partial names
|
||||||
terms = set((part for ns in names for part in ns.split()))
|
terms = set((part for ns in names for part in ns.split()))
|
||||||
# Add partials for the full terms (TO BE REMOVED)
|
|
||||||
terms.update((n for n in names))
|
|
||||||
# Add the full names
|
# Add the full names
|
||||||
terms.update((' ' + n for n in names))
|
terms.update((' ' + n for n in names))
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ no-test-db: bdd-no-test-db php
|
|||||||
bdd:
|
bdd:
|
||||||
cd bdd && behave -DREMOVE_TEMPLATE=1
|
cd bdd && behave -DREMOVE_TEMPLATE=1
|
||||||
|
|
||||||
bdd-no-test-db:
|
icu:
|
||||||
cd bdd && behave -DREMOVE_TEMPLATE=1 db osm2pgsql
|
cd bdd && behave -DREMOVE_TEMPLATE=1 -DTOKENIZER=legacy_icu
|
||||||
|
|
||||||
php:
|
php:
|
||||||
cd php && phpunit ./
|
cd php && phpunit ./
|
||||||
|
|||||||
@@ -232,23 +232,16 @@ def test_process_place_names(analyzer, getorcreate_term_id):
|
|||||||
@pytest.mark.parametrize('sep', [',' , ';'])
|
@pytest.mark.parametrize('sep', [',' , ';'])
|
||||||
def test_full_names_with_separator(analyzer, getorcreate_term_id, sep):
|
def test_full_names_with_separator(analyzer, getorcreate_term_id, sep):
|
||||||
with analyzer() as anl:
|
with analyzer() as anl:
|
||||||
full_names =
|
names = anl._compute_full_names({'name' : sep.join(('New York', 'Big Apple'))})
|
||||||
anl._compute_full_names({'name' : sep.join(('New York', 'Big Apple'))})
|
|
||||||
|
|
||||||
expect = set((anl.make_standard_word(w) for w in ('New York', 'Big Apple')))
|
assert names == set(('NEW YORK', 'BIG APPLE'))
|
||||||
|
|
||||||
assert full_names == expect
|
|
||||||
|
|
||||||
|
|
||||||
def test_process_place_names_with_bracket(analyzer, getorcreate_term_id):
|
def test_full_names_with_bracket(analyzer, getorcreate_term_id):
|
||||||
with analyzer() as anl:
|
with analyzer() as anl:
|
||||||
info = anl.process_place({'name' :
|
names = anl._compute_full_names({'name' : 'Houseboat (left)'})
|
||||||
{'name' : 'Houseboat (left)'}})
|
|
||||||
|
|
||||||
expect = set((anl.make_standard_word(w) for w in
|
assert names == set(('HOUSEBOAT (LEFT)', 'HOUSEBOAT'))
|
||||||
(' houseboat', ' houseboat left', 'houseboat', 'left')))
|
|
||||||
|
|
||||||
assert eval(info['names']) == expect
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('pcode', ['12345', 'AB 123', '34-345'])
|
@pytest.mark.parametrize('pcode', ['12345', 'AB 123', '34-345'])
|
||||||
|
|||||||
Reference in New Issue
Block a user