1 from nominatim_db.tools.special_phrases.sp_importer import SPImporter
 
   4 # Testing Database Class Pair Retrival using Conftest.py and placex
 
   5 def test_get_classtype_pair_data(placex_table, def_config, temp_db_conn):
 
   7         placex_table.add(cls='highway', typ='motorway')  # edge case 100
 
  10         placex_table.add(cls='amenity', typ='prison')  # edge case 99
 
  13         placex_table.add(cls='tourism', typ='hotel')
 
  15     importer = SPImporter(config=def_config, conn=temp_db_conn, sp_loader=None)
 
  17     result = importer.get_classtype_pairs(min=100)
 
  20         ("highway", "motorway"),
 
  24     assert result == expected, f"Expected {expected}, got {result}"
 
  27 def test_get_classtype_pair_data_more(placex_table, def_config, temp_db_conn):
 
  29         placex_table.add(cls='emergency', typ='firehydrant')  # edge case 99, not included
 
  32         placex_table.add(cls='amenity', typ='prison')
 
  35         placex_table.add(cls='tourism', typ='hotel')
 
  37     importer = SPImporter(config=def_config, conn=temp_db_conn, sp_loader=None)
 
  39     result = importer.get_classtype_pairs(min=100)
 
  42         ("amenity", "prison"),
 
  46     assert result == expected, f"Expected {expected}, got {result}"
 
  49 def test_get_classtype_pair_data_default(placex_table, def_config, temp_db_conn):
 
  51         placex_table.add(cls='emergency', typ='firehydrant')
 
  54         placex_table.add(cls='amenity', typ='prison')
 
  57         placex_table.add(cls='tourism', typ='hotel')
 
  59     importer = SPImporter(config=def_config, conn=temp_db_conn, sp_loader=None)
 
  61     result = importer.get_classtype_pairs()
 
  64         ("amenity", "prison"),
 
  66         ("emergency", "firehydrant")
 
  69     assert result == expected, f"Expected {expected}, got {result}"