X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/19d4e047f6d3c525f64978e0965d75556bfc5b1e..9934421442bf1a815096ef06ffa3f8c9ea11c0ac:/test/python/test_tokenizer_icu.py diff --git a/test/python/test_tokenizer_icu.py b/test/python/test_tokenizer_icu.py index 9a6f5a94..4d029dec 100644 --- a/test/python/test_tokenizer_icu.py +++ b/test/python/test_tokenizer_icu.py @@ -69,10 +69,11 @@ def analyzer(tokenizer_factory, test_config, monkeypatch, def _mk_analyser(norm=("[[:Punctuation:][:Space:]]+ > ' '",), trans=(':: upper()',), variants=('~gasse -> gasse', 'street => st', ), sanitizers=[]): - cfgstr = {'normalization' : list(norm), - 'sanitizers' : sanitizers, - 'transliteration' : list(trans), - 'variants' : [ {'words': list(variants)}]} + cfgstr = {'normalization': list(norm), + 'sanitizers': sanitizers, + 'transliteration': list(trans), + 'token-analysis': [{'analyzer': 'generic', + 'variants': [{'words': list(variants)}]}]} (test_config.project_dir / 'icu_tokenizer.yaml').write_text(yaml.dump(cfgstr)) tok.loader = ICURuleLoader(test_config) @@ -159,7 +160,7 @@ def test_init_new(tokenizer_factory, test_config, monkeypatch, db_prop): assert db_prop(icu_tokenizer.DBCFG_TERM_NORMALIZATION) == ':: lower();' -def test_init_word_table(tokenizer_factory, test_config, place_row, word_table): +def test_init_word_table(tokenizer_factory, test_config, place_row, temp_db_cursor): place_row(names={'name' : 'Test Area', 'ref' : '52'}) place_row(names={'name' : 'No Area'}) place_row(names={'name' : 'Holzstrasse'}) @@ -167,10 +168,7 @@ def test_init_word_table(tokenizer_factory, test_config, place_row, word_table): tok = tokenizer_factory() tok.init_new_db(test_config) - assert word_table.get_partial_words() == {('test', 1), - ('no', 1), ('area', 2), - ('holz', 1), ('strasse', 1), - ('str', 1)} + assert temp_db_cursor.table_exists('word') def test_init_from_project(monkeypatch, test_config, tokenizer_factory):