Add log_has_re

This commit is contained in:
Matthias 2019-02-03 13:50:03 +01:00
parent 02c3552954
commit 40fea4593f

View File

@ -1,6 +1,7 @@
# pragma pylint: disable=missing-docstring # pragma pylint: disable=missing-docstring
import json import json
import logging import logging
import re
from datetime import datetime from datetime import datetime
from functools import reduce from functools import reduce
from typing import Dict, Optional from typing import Dict, Optional
@ -27,6 +28,12 @@ def log_has(line, logs):
False) False)
def log_has_re(line, logs):
return reduce(lambda a, b: a or b,
filter(lambda x: re.match(line, x[2]), logs),
False)
def patch_exchange(mocker, api_mock=None, id='bittrex') -> None: def patch_exchange(mocker, api_mock=None, id='bittrex') -> None:
mocker.patch('freqtrade.exchange.Exchange._load_markets', MagicMock(return_value={})) mocker.patch('freqtrade.exchange.Exchange._load_markets', MagicMock(return_value={}))
mocker.patch('freqtrade.exchange.Exchange.validate_timeframes', MagicMock()) mocker.patch('freqtrade.exchange.Exchange.validate_timeframes', MagicMock())