+# SPDX-License-Identifier: GPL-2.0-only
+#
+# This file is part of Nominatim. (https://nominatim.org)
+#
+# Copyright (C) 2022 by the Nominatim developer community.
+# For a full list of authors see the git log.
"""
Tests for DB utility functions in db.utils
"""
@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):
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')}
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 ')}
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'),
@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):