mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-14 01:47:57 +00:00
Tests: parameter-agnostic has_pending monkeypatching
Instead of relying on runtime parameter compatibility between the patched `has_pending` method and `list.pop`, use a proxy lambda function that accepts arbitrary keyword params.
This commit is contained in:
@@ -91,8 +91,9 @@ class TestCliWithDb:
|
|||||||
postcode_mock = async_mock_func_factory(nominatim_db.indexer.indexer.Indexer,
|
postcode_mock = async_mock_func_factory(nominatim_db.indexer.indexer.Indexer,
|
||||||
'index_postcodes')
|
'index_postcodes')
|
||||||
|
|
||||||
|
has_pending_retvals = [True, False]
|
||||||
monkeypatch.setattr(nominatim_db.indexer.indexer.Indexer, 'has_pending',
|
monkeypatch.setattr(nominatim_db.indexer.indexer.Indexer, 'has_pending',
|
||||||
[False, True].pop)
|
lambda *args, **kwargs: has_pending_retvals.pop(0))
|
||||||
|
|
||||||
assert self.call_nominatim('index', *params) == 0
|
assert self.call_nominatim('index', *params) == 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user