+
+
+@pytest.mark.parametrize('number', ('6523', 'n/a', '4'))
+def test_convert_to_name_converted(def_config, number):
+ sanitizer_args = {'step': 'clean-housenumbers',
+ 'convert-to-name': (r'\d+', 'n/a')}
+
+ place = PlaceInfo({'address': {'housenumber': number}})
+ names, address = PlaceSanitizer([sanitizer_args], def_config).process_names(place)
+
+ 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(def_config, number):
+ sanitizer_args = {'step': 'clean-housenumbers',
+ 'convert-to-name': (r'\d+', 'n/a')}
+
+ place = PlaceInfo({'address': {'housenumber': number}})
+ names, address = PlaceSanitizer([sanitizer_args], def_config).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)