X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/f448423727ce8f96723820b6ad1aacc2e5310843..b0067a0345c2ab7793614925d6150141ef5f18f0:/test/python/api/search/test_token_assignment.py diff --git a/test/python/api/search/test_token_assignment.py b/test/python/api/search/test_token_assignment.py index 2ed55a0f..cde8495d 100644 --- a/test/python/api/search/test_token_assignment.py +++ b/test/python/api/search/test_token_assignment.py @@ -19,7 +19,8 @@ class MyToken(Token): def make_query(*args): q = QueryStruct([Phrase(args[0][1], '')]) - dummy = MyToken(3.0, 45, 1, 'foo', True) + dummy = MyToken(penalty=3.0, token=45, count=1, addr_count=1, + lookup_word='foo', is_indexed=True) for btype, ptype, _ in args[1:]: q.add_node(btype, ptype) @@ -337,3 +338,14 @@ def test_qualifier_after_housenumber(): (BreakType.WORD, PhraseType.NONE, [(3, TokenType.PARTIAL)])) check_assignments(yield_token_assignments(q)) + + +def test_qualifier_in_middle_of_phrase(): + q = make_query((BreakType.START, PhraseType.NONE, [(1, TokenType.PARTIAL)]), + (BreakType.PHRASE, PhraseType.NONE, [(2, TokenType.PARTIAL)]), + (BreakType.WORD, PhraseType.NONE, [(3, TokenType.QUALIFIER)]), + (BreakType.WORD, PhraseType.NONE, [(4, TokenType.PARTIAL)]), + (BreakType.PHRASE, PhraseType.NONE, [(5, TokenType.PARTIAL)])) + + check_assignments(yield_token_assignments(q)) +