X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/bb175cc95898de420781867973b38d033c187e81..c314a3092c5b51c7782015f6fa9ac093b46fa174:/test/python/db/test_utils.py diff --git a/test/python/db/test_utils.py b/test/python/db/test_utils.py index 9eea7ed1..b4335ab0 100644 --- a/test/python/db/test_utils.py +++ b/test/python/db/test_utils.py @@ -1,3 +1,9 @@ +# 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 DB utility functions in db.utils """ @@ -5,8 +11,8 @@ import json import pytest -import nominatim.db.utils as db_utils -from nominatim.errors import UsageError +import nominatim_db.db.utils as db_utils +from nominatim_db.errors import UsageError def test_execute_file_success(dsn, temp_db_cursor, tmp_path): tmpfile = tmp_path / 'test.sql' @@ -59,7 +65,7 @@ class TestCopyBuffer: @pytest.fixture(autouse=True) def setup_test_table(self, table_factory): - table_factory(self.TABLE_NAME, 'colA INT, colB TEXT') + table_factory(self.TABLE_NAME, 'col_a INT, col_b TEXT') def table_rows(self, cursor): @@ -86,7 +92,7 @@ class TestCopyBuffer: buf.add('foo') buf.copy_out(temp_db_cursor, self.TABLE_NAME, - columns=['colB']) + columns=['col_b']) assert self.table_rows(temp_db_cursor) == {(None, 'foo')} @@ -97,7 +103,7 @@ class TestCopyBuffer: buf.add(' two ', 2) buf.copy_out(temp_db_cursor, self.TABLE_NAME, - columns=['colB', 'colA']) + columns=['col_b', 'col_a']) assert self.table_rows(temp_db_cursor) == {(1, 'one'), (2, ' two ')} @@ -109,7 +115,7 @@ class TestCopyBuffer: buf.add('\\N') buf.copy_out(temp_db_cursor, self.TABLE_NAME, - columns=['colB']) + columns=['col_b']) assert self.table_rows(temp_db_cursor) == {(None, 'foo\tbar'), (None, 'sun\nson'), @@ -122,7 +128,7 @@ class TestCopyBufferJson: @pytest.fixture(autouse=True) def setup_test_table(self, table_factory): - table_factory(self.TABLE_NAME, 'colA INT, colB JSONB') + table_factory(self.TABLE_NAME, 'col_a INT, col_b JSONB') def table_rows(self, cursor):