+def test_create_place_classtype_table_and_indexes(
+ placex_table, getorcreate_amenity_funcs,
+ getorcreate_amenityoperator_funcs, special_phrases_importer):
+ pairs = {('class1', 'type1'), ('class2', 'type2')}
+
+ special_phrases_importer._create_place_classtype_table_and_indexes(pairs)
+
+def test_process_xml_content(special_phrases_importer, getorcreate_amenity_funcs,
+ getorcreate_amenityoperator_funcs):
+ special_phrases_importer._process_xml_content(get_test_xml_wiki_content(), 'en')
+
+def mock_get_wiki_content(lang):
+ return get_test_xml_wiki_content()
+
+def test_import_from_wiki(monkeypatch, special_phrases_importer, placex_table,
+ getorcreate_amenity_funcs, getorcreate_amenityoperator_funcs):
+ #mocker.patch.object(special_phrases_importer, '_get_wiki_content', new=mock_get_wiki_content)
+ monkeypatch.setattr('nominatim.tools.special_phrases.SpecialPhrasesImporter._get_wiki_content', mock_get_wiki_content)
+ special_phrases_importer.import_from_wiki(['en'])
+
+def get_test_xml_wiki_content():
+ xml_test_content_path = (TEST_BASE_DIR / 'testdata' / 'special_phrases_test_content.txt').resolve()
+ with open(xml_test_content_path) as xml_content_reader:
+ return xml_content_reader.read()
+
+@pytest.fixture
+def special_phrases_importer(temp_db_conn, def_config, tmp_phplib_dir):
+ return SpecialPhrasesImporter(def_config, tmp_phplib_dir, temp_db_conn)
+