X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c06a1d007a4e67ab5caf5bf63d351f83e4e54ab6..d933ead2b503bd0377b1c8f7c0984f29b23ed908:/test/python/test_tools_database_import.py diff --git a/test/python/test_tools_database_import.py b/test/python/test_tools_database_import.py index ef406353..2291c166 100644 --- a/test/python/test_tools_database_import.py +++ b/test/python/test_tools_database_import.py @@ -1,10 +1,10 @@ """ 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 @@ -34,9 +34,9 @@ def test_setup_skeleton(src_dir, nonexistant_db, no_partitions): 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: @@ -147,7 +147,7 @@ def test_truncate_database_tables(temp_db_conn, temp_db_cursor, table_factory): @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) @@ -180,7 +180,7 @@ def test_create_country_names(temp_db_with_extensions, temp_db_conn, temp_db_cur 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')),