From 9447c90b09c995710ec2a1ee4347e276d69acdf9 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 27 Nov 2025 16:05:49 +0100 Subject: [PATCH] adapt tests to new country token format --- test/python/api/search/test_api_search_query.py | 3 +++ test/python/api/search/test_db_search_builder.py | 3 +++ test/python/api/search/test_token_assignment.py | 3 +++ test/python/api/test_api_search.py | 2 +- test/python/tokenizer/test_icu.py | 2 +- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/python/api/search/test_api_search_query.py b/test/python/api/search/test_api_search_query.py index ea3b9772..1f229111 100644 --- a/test/python/api/search/test_api_search_query.py +++ b/test/python/api/search/test_api_search_query.py @@ -17,6 +17,9 @@ class MyToken(query.Token): def get_category(self): return 'this', 'that' + def get_country(self): + return 'cc' + def mktoken(tid: int): return MyToken(penalty=3.0, token=tid, count=1, addr_count=1, diff --git a/test/python/api/search/test_db_search_builder.py b/test/python/api/search/test_db_search_builder.py index d304e197..18beb6f2 100644 --- a/test/python/api/search/test_db_search_builder.py +++ b/test/python/api/search/test_db_search_builder.py @@ -21,6 +21,9 @@ class MyToken(Token): def get_category(self): return 'this', 'that' + def get_country(self): + return self.lookup_word + def make_query(*args): q = QueryStruct([Phrase(qmod.PHRASE_ANY, '')]) diff --git a/test/python/api/search/test_token_assignment.py b/test/python/api/search/test_token_assignment.py index 0b2d7cb9..bc47d358 100644 --- a/test/python/api/search/test_token_assignment.py +++ b/test/python/api/search/test_token_assignment.py @@ -20,6 +20,9 @@ class MyToken(Token): def get_category(self): return 'this', 'that' + def get_country(self): + return 'cc' + def make_query(*args): q = QueryStruct([Phrase(args[0][1], '')]) diff --git a/test/python/api/test_api_search.py b/test/python/api/test_api_search.py index 59a83aa9..04317dec 100644 --- a/test/python/api/test_api_search.py +++ b/test/python/api/test_api_search.py @@ -99,7 +99,7 @@ def test_address_simple_places(apiobj, frontend, atype, address, search): def test_address_country(apiobj, frontend): - apiobj.add_word_table([(None, 'ro', 'C', 'ro', None)]) + apiobj.add_word_table([(None, 'ro', 'C', 'ro', {'cc': 'ro'})]) apiobj.add_country('ro', 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))') apiobj.add_country_name('ro', {'name': 'România'}) diff --git a/test/python/tokenizer/test_icu.py b/test/python/tokenizer/test_icu.py index 39796822..cf4140c9 100644 --- a/test/python/tokenizer/test_icu.py +++ b/test/python/tokenizer/test_icu.py @@ -405,7 +405,7 @@ class TestPlaceNames: info = self.analyzer.process_place(place) self.expect_name_terms(info, '#norge', 'norge') - assert word_table.get_country() == {('no', 'NORGE')} + assert word_table.get_country() == {('no', 'NORGE', 'Norge')} class TestPlaceAddress: -- 2.39.5