mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-15 10:57:58 +00:00
introduce custom object for cmdline arguments
Allows to define special functions over the arguments. Also splits CLI tests in two files as they have become too many.
This commit is contained in:
18
test/python/mocks.py
Normal file
18
test/python/mocks.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""
|
||||
Custom mocks for testing.
|
||||
"""
|
||||
|
||||
|
||||
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
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
self.called += 1
|
||||
self.last_args = args
|
||||
self.last_kwargs = kwargs
|
||||
return self.return_value
|
||||
Reference in New Issue
Block a user