X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/610f2cc254cf442c895351907be6405f03026903..5617bffe2fcf527365bcd801304180e1cc07cb98:/test/python/tokenizer/sanitizers/test_clean_housenumbers.py?ds=inline diff --git a/test/python/tokenizer/sanitizers/test_clean_housenumbers.py b/test/python/tokenizer/sanitizers/test_clean_housenumbers.py index 8a27de6f..128e1201 100644 --- a/test/python/tokenizer/sanitizers/test_clean_housenumbers.py +++ b/test/python/tokenizer/sanitizers/test_clean_housenumbers.py @@ -10,7 +10,7 @@ Tests for the sanitizer that normalizes housenumbers. import pytest from nominatim.tokenizer.place_sanitizer import PlaceSanitizer -from nominatim.indexer.place_info import PlaceInfo +from nominatim.data.place_info import PlaceInfo @pytest.fixture def sanitize(request): @@ -55,3 +55,14 @@ def test_convert_to_name_converted(number): assert ('housenumber', number) in set((p.kind, p.name) for p in names) assert 'housenumber' not in set(p.kind for p in address) + +@pytest.mark.parametrize('number', ('a54', 'n.a', 'bow')) +def test_convert_to_name_unconverted(number): + sanitizer_args = {'step': 'clean-housenumbers', + 'convert-to-name': (r'\d+', 'n/a')} + + place = PlaceInfo({'address': {'housenumber': number}}) + names, address = PlaceSanitizer([sanitizer_args]).process_names(place) + + assert 'housenumber' not in set(p.kind for p in names) + assert ('housenumber', number) in set((p.kind, p.name) for p in address)