X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/b90e719da595b6760b39b7cd64ee29447de2d5e8..4da4cbfe27a576ae011430b2de205c74435e241b:/test/python/indexer/test_indexing.py?ds=inline diff --git a/test/python/indexer/test_indexing.py b/test/python/indexer/test_indexing.py index 4c9d940d..93481e8a 100644 --- a/test/python/indexer/test_indexing.py +++ b/test/python/indexer/test_indexing.py @@ -1,11 +1,17 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of Nominatim. (https://nominatim.org) +# +# Copyright (C) 2024 by the Nominatim developer community. +# For a full list of authors see the git log. """ Tests for running the indexing. """ import itertools import pytest -from nominatim.indexer import indexer -from nominatim.tokenizer import factory +from nominatim_db.indexer import indexer +from nominatim_db.tokenizer import factory class IndexerTestDB: @@ -145,9 +151,8 @@ def test_db(temp_db_conn): @pytest.fixture -def test_tokenizer(tokenizer_mock, def_config, tmp_path): - def_config.project_dir = tmp_path - return factory.create_tokenizer(def_config) +def test_tokenizer(tokenizer_mock, project_env): + return factory.create_tokenizer(project_env) @pytest.mark.parametrize("threads", [1, 15]) @@ -172,25 +177,16 @@ def test_index_all_by_rank(test_db, threads, test_tokenizer): SELECT count(*) FROM placex p WHERE rank_address > 0 AND indexed_date >= (SELECT min(indexed_date) FROM placex o WHERE p.rank_address < o.rank_address)""") == 0 - # placex rank < 30 objects come before interpolations + # placex address ranked objects come before interpolations assert test_db.scalar( - """SELECT count(*) FROM placex WHERE rank_address < 30 + """SELECT count(*) FROM placex WHERE rank_address > 0 AND indexed_date > (SELECT min(indexed_date) FROM location_property_osmline)""") == 0 - # placex rank = 30 objects come after interpolations + # rank 0 comes after all other placex objects assert test_db.scalar( - """SELECT count(*) FROM placex WHERE rank_address = 30 - AND indexed_date < - (SELECT max(indexed_date) FROM location_property_osmline)""") == 0 - # rank 0 comes after rank 29 and before rank 30 - assert test_db.scalar( - """SELECT count(*) FROM placex WHERE rank_address < 30 + """SELECT count(*) FROM placex WHERE rank_address > 0 AND indexed_date > (SELECT min(indexed_date) FROM placex WHERE rank_address = 0)""") == 0 - assert test_db.scalar( - """SELECT count(*) FROM placex WHERE rank_address = 30 - AND indexed_date < - (SELECT max(indexed_date) FROM placex WHERE rank_address = 0)""") == 0 @pytest.mark.parametrize("threads", [1, 15])