mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-15 10:57:58 +00:00
adapt tests to new country token format
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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, '')])
|
||||
|
||||
@@ -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], '')])
|
||||
|
||||
@@ -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'})
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user