adapt tests to new country token format

This commit is contained in:
Sarah Hoffmann
2025-11-27 16:05:49 +01:00
parent 81c6cb72e6
commit 9447c90b09
5 changed files with 11 additions and 2 deletions

View File

@@ -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,

View File

@@ -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, '')])

View File

@@ -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], '')])

View File

@@ -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'})

View File

@@ -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: