"""
Tests for functions to import a new database.
"""
+from pathlib import Path
+
import pytest
import psycopg2
-import sys
-from pathlib import Path
from nominatim.tools import database_import
from nominatim.errors import UsageError
try:
with conn.cursor() as cur:
cur.execute("SELECT distinct partition FROM country_name")
- partitions = set([r[0] for r in list(cur)])
+ partitions = set((r[0] for r in list(cur)))
if no_partitions:
- assert partitions == set([0])
+ assert partitions == set((0, ))
else:
assert len(partitions) > 10
finally:
@pytest.mark.parametrize("threads", (1, 5))
-def test_load_data(dsn, src_dir, place_row, placex_table, osmline_table,
+def test_load_data(dsn, place_row, placex_table, osmline_table,
word_table, temp_db_cursor, threads):
for func in ('precompute_words', 'getorcreate_housenumber_id', 'make_standard_name'):
temp_db_cursor.execute("""CREATE FUNCTION {} (src TEXT)
assert len(tokenizer.analyser_cache['countries']) == 2
- result_set = {k: set(v) for k, v in tokenizer.analyser_cache['countries']}
+ result_set = {k: set(v.values()) for k, v in tokenizer.analyser_cache['countries']}
if languages:
assert result_set == {'us' : set(('us', 'us1', 'United States')),