]> git.openstreetmap.org Git - nominatim.git/blob - test/python/test_tokenizer_legacy.py
cb6fb00bb85f67eadf0a8af8fdad63be5e1b7498
[nominatim.git] / test / python / test_tokenizer_legacy.py
1 """
2 Test for legacy tokenizer.
3 """
4 import pytest
5
6 from nominatim.tokenizer import legacy_tokenizer
7 from nominatim.db import properties
8
9 @pytest.fixture
10 def tokenizer(dsn, tmp_path, def_config, property_table):
11     tok = legacy_tokenizer.create(dsn, tmp_path)
12     tok.init_new_db(def_config)
13
14     return tok
15
16 def test_init_new(dsn, tmp_path, def_config, property_table, monkeypatch, temp_db_conn):
17     monkeypatch.setenv('NOMINATIM_TERM_NORMALIZATION', 'xxvv')
18
19     tok = legacy_tokenizer.create(dsn, tmp_path)
20     tok.init_new_db(def_config)
21
22     assert properties.get_property(temp_db_conn, legacy_tokenizer.DBCFG_NORMALIZATION) == 'xxvv'
23
24
25 def test_init_from_project(tokenizer):
26     tokenizer.init_from_project()
27
28     assert tokenizer.normalization is not None