forked from hans/Nominatim
remove legacy tokenizer and direct tests
This commit is contained in:
@@ -14,8 +14,6 @@ from nominatim_db.errors import UsageError
|
||||
from nominatim_db.db.connection import server_version_tuple
|
||||
import nominatim_db.version
|
||||
|
||||
from mock_legacy_word_table import MockLegacyWordTable
|
||||
|
||||
class DummyTokenizer:
|
||||
|
||||
def update_sql_functions(self, config):
|
||||
@@ -28,10 +26,6 @@ def postprocess_mock(monkeypatch):
|
||||
monkeypatch.setattr(migration.tokenizer_factory, 'get_tokenizer_for_db',
|
||||
lambda *args: DummyTokenizer())
|
||||
|
||||
@pytest.fixture
|
||||
def legacy_word_table(temp_db_conn):
|
||||
return MockLegacyWordTable(temp_db_conn)
|
||||
|
||||
|
||||
def test_no_migration_old_versions(temp_db_with_extensions, table_factory, def_config):
|
||||
table_factory('country_name', 'name HSTORE, country_code TEXT')
|
||||
@@ -145,26 +139,6 @@ def test_add_nominatim_property_table_repeat(temp_db_conn, temp_db_cursor,
|
||||
assert temp_db_cursor.table_exists('nominatim_properties')
|
||||
|
||||
|
||||
def test_change_housenumber_transliteration(temp_db_conn, temp_db_cursor,
|
||||
legacy_word_table, placex_table):
|
||||
placex_table.add(housenumber='3A')
|
||||
|
||||
temp_db_cursor.execute("""CREATE OR REPLACE FUNCTION make_standard_name(name TEXT)
|
||||
RETURNS TEXT AS $$ SELECT lower(name) $$ LANGUAGE SQL """)
|
||||
temp_db_cursor.execute("""CREATE OR REPLACE FUNCTION getorcreate_housenumber_id(lookup_word TEXT)
|
||||
RETURNS INTEGER AS $$ SELECT 4325 $$ LANGUAGE SQL """)
|
||||
|
||||
migration.change_housenumber_transliteration(temp_db_conn)
|
||||
temp_db_conn.commit()
|
||||
|
||||
assert temp_db_cursor.scalar('SELECT housenumber from placex') == '3a'
|
||||
|
||||
migration.change_housenumber_transliteration(temp_db_conn)
|
||||
temp_db_conn.commit()
|
||||
|
||||
assert temp_db_cursor.scalar('SELECT housenumber from placex') == '3a'
|
||||
|
||||
|
||||
def test_switch_placenode_geometry_index(temp_db_conn, temp_db_cursor, placex_table):
|
||||
temp_db_cursor.execute("""CREATE INDEX idx_placex_adminname
|
||||
ON placex (place_id)""")
|
||||
|
||||
Reference in New Issue
Block a user