From: Sarah Hoffmann Date: Mon, 7 Feb 2022 10:45:12 +0000 (+0100) Subject: add tests for housenumber-as-name feature X-Git-Tag: v4.1.0~82^2~1 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/a6b4e8ff6712f7d38cf32d28ff9f6bbd6545e530 add tests for housenumber-as-name feature --- diff --git a/test/python/tokenizer/sanitizers/test_clean_housenumbers.py b/test/python/tokenizer/sanitizers/test_clean_housenumbers.py index 8a27de6f..34cc7413 100644 --- a/test/python/tokenizer/sanitizers/test_clean_housenumbers.py +++ b/test/python/tokenizer/sanitizers/test_clean_housenumbers.py @@ -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)