test: fix linting errors

This commit is contained in:
Sarah Hoffmann
2021-05-19 23:07:39 +02:00
parent 01f5a9ff84
commit 430c316e45
31 changed files with 418 additions and 397 deletions

View File

@@ -5,6 +5,8 @@ import itertools
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.
@@ -12,6 +14,8 @@ class MockParamCapture:
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
@@ -37,11 +41,11 @@ class MockWordTable:
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()
@@ -125,3 +129,16 @@ class MockPlacexTable:
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)