1 # SPDX-License-Identifier: GPL-3.0-or-later
3 # This file is part of Nominatim. (https://nominatim.org)
5 # Copyright (C) 2026 by the Nominatim developer community.
6 # For a full list of authors see the git log.
8 from nominatim_db.tools.special_phrases.sp_importer import SPImporter
11 # Testing Database Class Pair Retrival using Conftest.py and placex
12 def test_get_classtype_pair_data(placex_row, def_config, temp_db_conn):
14 placex_row(cls='highway', typ='motorway') # edge case 100
17 placex_row(cls='amenity', typ='prison') # edge case 99
20 placex_row(cls='tourism', typ='hotel')
22 importer = SPImporter(config=def_config, conn=temp_db_conn, sp_loader=None)
24 result = importer.get_classtype_pairs(min=100)
27 ("highway", "motorway"),
32 def test_get_classtype_pair_data_more(placex_row, def_config, temp_db_conn):
34 placex_row(cls='emergency', typ='firehydrant') # edge case 99, not included
37 placex_row(cls='amenity', typ='prison')
40 placex_row(cls='tourism', typ='hotel')
42 importer = SPImporter(config=def_config, conn=temp_db_conn, sp_loader=None)
44 result = importer.get_classtype_pairs(min=100)
47 ("amenity", "prison"),
52 def test_get_classtype_pair_data_default(placex_row, def_config, temp_db_conn):
54 placex_row(cls='emergency', typ='firehydrant')
57 placex_row(cls='amenity', typ='prison')
60 placex_row(cls='tourism', typ='hotel')
62 importer = SPImporter(config=def_config, conn=temp_db_conn, sp_loader=None)
64 result = importer.get_classtype_pairs()
67 ("amenity", "prison"),
69 ("emergency", "firehydrant")