]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/tokenizer/sanitizers/test_split_name_list.py
enable flake for Python tests
[nominatim.git] / test / python / tokenizer / sanitizers / test_split_name_list.py
index fbfd72da514e974b2523c7fc869ed3625af44f7f..ec4869b3495c3f56127a8e22c6f1db3050ada38d 100644 (file)
@@ -2,7 +2,7 @@
 #
 # This file is part of Nominatim. (https://nominatim.org)
 #
-# Copyright (C) 2024 by the Nominatim developer community.
+# Copyright (C) 2025 by the Nominatim developer community.
 # For a full list of authors see the git log.
 """
 Tests for the sanitizer that splits multivalue lists.
@@ -14,20 +14,19 @@ from nominatim_db.data.place_info import PlaceInfo
 
 from nominatim_db.errors import UsageError
 
+
 class TestSplitName:
 
     @pytest.fixture(autouse=True)
     def setup_country(self, def_config):
         self.config = def_config
 
-
     def run_sanitizer_on(self, **kwargs):
         place = PlaceInfo({'name': kwargs})
         name, _ = PlaceSanitizer([{'step': 'split-name-list'}], self.config).process_names(place)
 
         return sorted([(p.name, p.kind, p.suffix) for p in name])
 
-
     def sanitize_with_delimiter(self, delimiter, name):
         place = PlaceInfo({'name': {'name': name}})
         san = PlaceSanitizer([{'step': 'split-name-list', 'delimiters': delimiter}],
@@ -36,12 +35,10 @@ class TestSplitName:
 
         return sorted([p.name for p in name])
 
-
     def test_simple(self):
         assert self.run_sanitizer_on(name='ABC') == [('ABC', 'name', None)]
         assert self.run_sanitizer_on(name='') == [('', 'name', None)]
 
-
     def test_splits(self):
         assert self.run_sanitizer_on(name='A;B;C') == [('A', 'name', None),
                                                        ('B', 'name', None),
@@ -49,7 +46,6 @@ class TestSplitName:
         assert self.run_sanitizer_on(short_name=' House, boat ') == [('House', 'short_name', None),
                                                                      ('boat', 'short_name', None)]
 
-
     def test_empty_fields(self):
         assert self.run_sanitizer_on(name='A;;B') == [('A', 'name', None),
                                                       ('B', 'name', None)]
@@ -58,14 +54,12 @@ class TestSplitName:
         assert self.run_sanitizer_on(name=' ;B') == [('B', 'name', None)]
         assert self.run_sanitizer_on(name='B,') == [('B', 'name', None)]
 
-
     def test_custom_delimiters(self):
         assert self.sanitize_with_delimiter(':', '12:45,3') == ['12', '45,3']
         assert self.sanitize_with_delimiter('\\', 'a;\\b!#@ \\') == ['a;', 'b!#@']
         assert self.sanitize_with_delimiter('[]', 'foo[to]be') == ['be', 'foo', 'to']
         assert self.sanitize_with_delimiter(' ', 'morning  sun') == ['morning', 'sun']
 
-
     def test_empty_delimiter_set(self):
         with pytest.raises(UsageError):
             self.sanitize_with_delimiter('', 'abc')