]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/test_tools_sp_csv_loader.py
switch to a more flexible variant description format
[nominatim.git] / test / python / test_tools_sp_csv_loader.py
index ccc9996d64c581c33c3d5107fcffe2ed80be554d..80d5989e92a89fba67160acba63dfa46a8d08cf7 100644 (file)
@@ -1,12 +1,10 @@
 """
     Tests for methods of the SPCsvLoader class.
 """
-from nominatim.errors import UsageError
 import pytest
-from pathlib import Path
-from nominatim.tools.special_phrases.sp_csv_loader import SPCsvLoader
 
-TEST_BASE_DIR = Path(__file__) / '..' / '..'
+from nominatim.errors import UsageError
+from nominatim.tools.special_phrases.sp_csv_loader import SPCsvLoader
 
 def test_parse_csv(sp_csv_loader):
     """
@@ -43,16 +41,20 @@ def check_phrases_content(phrases):
         the right phrases of the sp_csv_test.csv special phrases.
     """
     return  len(phrases) > 1 \
-            and any(p.p_label == 'Billboard' and p.p_class == 'advertising' and p.p_type == 'billboard'
+            and any(p.p_label == 'Billboard'
+                    and p.p_class == 'advertising'
+                    and p.p_type == 'billboard'
                     and p.p_operator == '-' for p in phrases) \
-            and any(p.p_label == 'Zip Lines' and p.p_class == 'aerialway' and p.p_type == 'zip_line'
+            and any(p.p_label == 'Zip Lines'
+                    and p.p_class == 'aerialway'
+                    and p.p_type == 'zip_line'
                     and p.p_operator == '-' for p in phrases)
 
 @pytest.fixture
-def sp_csv_loader():
+def sp_csv_loader(src_dir):
     """
         Return an instance of SPCsvLoader.
     """
-    csv_path = (TEST_BASE_DIR / 'testdata' / 'sp_csv_test.csv').resolve()
+    csv_path = (src_dir / 'test' / 'testdata' / 'sp_csv_test.csv').resolve()
     loader = SPCsvLoader(csv_path)
     return loader