X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c3788d765ed4e7ddf00794085af757714bc102cf..3742fa2929619a4c54a50d3e79e0eeadb4d6ca6f:/test/python/mock_legacy_word_table.py diff --git a/test/python/mock_legacy_word_table.py b/test/python/mock_legacy_word_table.py index fa94d035..d1c523eb 100644 --- a/test/python/mock_legacy_word_table.py +++ b/test/python/mock_legacy_word_table.py @@ -1,13 +1,14 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: GPL-3.0-or-later # # This file is part of Nominatim. (https://nominatim.org) # -# Copyright (C) 2022 by the Nominatim developer community. +# Copyright (C) 2024 by the Nominatim developer community. # For a full list of authors see the git log. """ Legacy word table for testing with functions to prefil and test contents of the table. """ +from nominatim_db.db.connection import execute_scalar class MockLegacyWordTable: """ A word table for testing using legacy word table structure. @@ -58,13 +59,11 @@ class MockLegacyWordTable: def count(self): - with self.conn.cursor() as cur: - return cur.scalar("SELECT count(*) FROM word") + return execute_scalar(self.conn, "SELECT count(*) FROM word") def count_special(self): - with self.conn.cursor() as cur: - return cur.scalar("SELECT count(*) FROM word WHERE class != 'place'") + return execute_scalar(self.conn, "SELECT count(*) FROM word WHERE class != 'place'") def get_special(self):