+# SPDX-License-Identifier: GPL-2.0-only
+#
+# This file is part of Nominatim. (https://nominatim.org)
+#
+# Copyright (C) 2022 by the Nominatim developer community.
+# For a full list of authors see the git log.
"""
Test for legacy tokenizer.
"""
func_file = test_config.lib_dir.sql / 'tokenizer' / 'legacy_tokenizer_indices.sql'
func_file.write_text("""CREATE FUNCTION test() RETURNS TEXT
- AS $$ SELECT 'b' $$ LANGUAGE SQL""")
+ AS $$ SELECT 'b'::text $$ LANGUAGE SQL""")
tok = tokenizer_factory()
tok.init_new_db(test_config)
# Inject a bad transliteration.
temp_db_cursor.execute("""CREATE OR REPLACE FUNCTION make_standard_name(name TEXT)
- RETURNS TEXT AS $$ SELECT 'garbage'; $$ LANGUAGE SQL""")
+ RETURNS TEXT AS $$ SELECT 'garbage'::text; $$ LANGUAGE SQL""")
assert tok.check_database(False) is not None
search_name_count > 0""") > 0
+def test_update_word_tokens(tokenizer_factory):
+ tok = tokenizer_factory()
+
+ # This is a noop and should just pass.
+ tok.update_word_tokens()
+
+
def test_normalize(analyzer):
assert analyzer.normalize('TEsT') == 'test'