Removed class type pair getter that used style sheets from both spi_importer and the associated testing function

This commit is contained in:
anqixxx
2025-04-14 10:14:57 -07:00
parent 1952290359
commit 59a947c5f5
2 changed files with 0 additions and 96 deletions

View File

@@ -1,80 +1,9 @@
import pytest
import tempfile
import json
import os
from nominatim_db.tools.special_phrases.sp_importer import SPImporter
# Testing Style Class Pair Retrival
@pytest.fixture
def sample_style_file():
sample_data = [
{
"keys" : ["emergency"],
"values" : {
"fire_hydrant" : "skip",
"yes" : "skip",
"no" : "skip",
"" : "main"
}
},
{
"keys" : ["historic", "military"],
"values" : {
"no" : "skip",
"yes" : "skip",
"" : "main"
}
},
{
"keys" : ["name:prefix", "name:suffix", "name:prefix:*", "name:suffix:*",
"name:botanical", "wikidata", "*:wikidata"],
"values" : {
"" : "extra"
}
},
{
"keys" : ["addr:housename"],
"values" : {
"" : "name,house"
}
},
{
"keys": ["highway"],
"values": {
"motorway": "main",
"": "skip"
}
}
]
content = ",".join(json.dumps(entry) for entry in sample_data)
with tempfile.NamedTemporaryFile(mode='w+', delete=False) as tmp:
tmp.write(content)
tmp_path = tmp.name
yield tmp_path
os.remove(tmp_path)
def test_get_classtype_style(sample_style_file):
class Config:
def get_import_style_file(self):
return sample_style_file
def load_sub_configuration(self, name):
return {'blackList': {}, 'whiteList': {}}
config = Config()
importer = SPImporter(config=config, conn=None, sp_loader=None)
result = importer.get_classtype_pairs_style()
expected = {
("highway", "motorway"),
}
assert expected.issubset(result)
# Testing Database Class Pair Retrival using Mock Database
def test_get_classtype_pairs(monkeypatch):
class Config: