From dd332caa4de14a454a738a1e8210e29fbce83eef Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 12 Feb 2026 21:15:03 +0100 Subject: [PATCH] simplify property test table implementation --- test/python/conftest.py | 11 +++++++++-- test/python/mocks.py | 19 ------------------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/test/python/conftest.py b/test/python/conftest.py index 6e4e3ba1..8ba27b34 100644 --- a/test/python/conftest.py +++ b/test/python/conftest.py @@ -17,7 +17,7 @@ SRC_DIR = (Path(__file__) / '..' / '..' / '..').resolve() sys.path.insert(0, str(SRC_DIR / 'src')) from nominatim_db.config import Configuration -from nominatim_db.db import connection +from nominatim_db.db import connection, properties from nominatim_db.db.sql_preprocessor import SQLPreprocessor import nominatim_db.tokenizer.factory @@ -159,7 +159,14 @@ def load_sql(temp_db_conn, country_row): def property_table(load_sql, temp_db_conn): load_sql('tables/nominatim_properties.sql') - return mocks.MockPropertyTable(temp_db_conn) + class _PropTable: + def set(self, name, value): + properties.set_property(temp_db_conn, name, value) + + def get(self, name): + return properties.get_property(temp_db_conn, name) + + return _PropTable() @pytest.fixture diff --git a/test/python/mocks.py b/test/python/mocks.py index 16a5747e..7cc8c815 100644 --- a/test/python/mocks.py +++ b/test/python/mocks.py @@ -9,8 +9,6 @@ Custom mocks for testing. """ import itertools -from nominatim_db.db import properties - class MockPlacexTable: """ A placex table for testing. @@ -66,20 +64,3 @@ class MockPlacexTable: place_id = cur.fetchone()[0] self.conn.commit() return place_id - - -class MockPropertyTable: - """ A property table for testing. - """ - def __init__(self, conn): - self.conn = conn - - def set(self, name, value): - """ Set a property in the table to the given value. - """ - properties.set_property(self.conn, name, value) - - def get(self, name): - """ Set a property in the table to the given value. - """ - return properties.get_property(self.conn, name)