X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/75c631f08093d0cc7330d313bd3bb58cb2c1924b..f960a9bf7fd1702b3d66995dd69307bd91d61a08:/test/python/tokenizer/test_place_sanitizer.py?ds=sidebyside diff --git a/test/python/tokenizer/test_place_sanitizer.py b/test/python/tokenizer/test_place_sanitizer.py index 389b068c..25844459 100644 --- a/test/python/tokenizer/test_place_sanitizer.py +++ b/test/python/tokenizer/test_place_sanitizer.py @@ -1,11 +1,17 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of Nominatim. (https://nominatim.org) +# +# Copyright (C) 2024 by the Nominatim developer community. +# For a full list of authors see the git log. """ Tests for execution of the sanitztion step. """ import pytest -from nominatim.errors import UsageError -import nominatim.tokenizer.place_sanitizer as sanitizer -from nominatim.indexer.place_info import PlaceInfo +from nominatim_db.errors import UsageError +import nominatim_db.tokenizer.place_sanitizer as sanitizer +from nominatim_db.data.place_info import PlaceInfo def test_placeinfo_clone_new_name(): @@ -41,8 +47,8 @@ def test_placeinfo_has_attr(): assert not place.has_attr('whatever') -def test_sanitizer_default(): - san = sanitizer.PlaceSanitizer([{'step': 'split-name-list'}]) +def test_sanitizer_default(def_config): + san = sanitizer.PlaceSanitizer([{'step': 'split-name-list'}], def_config) name, address = san.process_names(PlaceInfo({'name': {'name:de:de': '1;2;3'}, 'address': {'street': 'Bald'}})) @@ -57,8 +63,8 @@ def test_sanitizer_default(): @pytest.mark.parametrize('rules', [None, []]) -def test_sanitizer_empty_list(rules): - san = sanitizer.PlaceSanitizer(rules) +def test_sanitizer_empty_list(def_config, rules): + san = sanitizer.PlaceSanitizer(rules, def_config) name, address = san.process_names(PlaceInfo({'name': {'name:de:de': '1;2;3'}})) @@ -66,6 +72,6 @@ def test_sanitizer_empty_list(rules): assert all(isinstance(n, sanitizer.PlaceName) for n in name) -def test_sanitizer_missing_step_definition(): +def test_sanitizer_missing_step_definition(def_config): with pytest.raises(UsageError): - san = sanitizer.PlaceSanitizer([{'id': 'split-name-list'}]) + san = sanitizer.PlaceSanitizer([{'id': 'split-name-list'}], def_config)