import psycopg2.extras
+from nominatim.db import properties
+
class MockParamCapture:
""" Mock that records the parameters with which a function was called
as well as the number of calls.
def __init__(self, retval=0):
self.called = 0
self.return_value = retval
+ self.last_args = None
+ self.last_kwargs = None
def __call__(self, *args, **kwargs):
self.called += 1
conn.commit()
- def add_special(self, word_token, word, cls, typ, op):
+ def add_special(self, word_token, word, cls, typ, oper):
with self.conn.cursor() as cur:
cur.execute("""INSERT INTO word (word_token, word, class, type, operator)
VALUES (%s, %s, %s, %s, %s)
- """, (word_token, word, cls, typ, op))
+ """, (word_token, word, cls, typ, oper))
self.conn.commit()
admin_level, address, extratags, 'SRID=4326;' + geom,
country))
self.conn.commit()
+
+
+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)