]> git.openstreetmap.org Git - nominatim.git/blob - test/python/mocks.py
prepare 3.7.0 release
[nominatim.git] / test / python / mocks.py
1 """
2 Custom mocks for testing.
3 """
4
5
6 class MockParamCapture:
7     """ Mock that records the parameters with which a function was called
8         as well as the number of calls.
9     """
10     def __init__(self, retval=0):
11         self.called = 0
12         self.return_value = retval
13
14     def __call__(self, *args, **kwargs):
15         self.called += 1
16         self.last_args = args
17         self.last_kwargs = kwargs
18         return self.return_value