autopep8 applied

This commit is contained in:
misagh 2018-10-04 18:07:47 +02:00
parent 06d75a8bad
commit 77cac9e562
2 changed files with 17 additions and 7 deletions

View File

@ -53,16 +53,19 @@ def patch_edge(mocker) -> None:
['NEO/BTC', -0.20, 0.66, 3.71, 0.50, 1.71],
['LTC/BTC', -0.21, 0.66, 3.71, 0.50, 1.71],
]
))
))
mocker.patch('freqtrade.edge.Edge.stoploss', MagicMock(return_value=-0.20))
mocker.patch('freqtrade.edge.Edge.calculate', MagicMock(return_value=True))
def get_patched_edge(mocker, config) -> Edge:
patch_edge(mocker)
edge = Edge(config)
return edge
# Functions for recurrent object patching
def get_patched_freqtradebot(mocker, config) -> FreqtradeBot:
"""
This function patch _init_modules() to not call dependencies

View File

@ -268,7 +268,13 @@ def test_edge_overrides_stake_amount(mocker, default_conf) -> None:
assert freqtrade._get_trade_stake_amount('LTC/BTC') == 0.02381
def test_edge_overrides_stoploss(limit_buy_order, fee, markets, caplog, mocker, default_conf) -> None:
def test_edge_overrides_stoploss(
limit_buy_order,
fee,
markets,
caplog,
mocker,
default_conf) -> None:
default_conf['edge']['enabled'] = True
patch_RPCManager(mocker)
patch_exchange(mocker)
@ -309,7 +315,7 @@ def test_edge_overrides_stoploss(limit_buy_order, fee, markets, caplog, mocker,
def test_edge_should_ignore_strategy_stoploss(limit_buy_order, fee, markets,
mocker, default_conf) -> None:
mocker, default_conf) -> None:
default_conf['edge']['enabled'] = True
patch_RPCManager(mocker)
patch_exchange(mocker)
@ -345,6 +351,7 @@ def test_edge_should_ignore_strategy_stoploss(limit_buy_order, fee, markets,
# stoploss shoud be hit
assert freqtrade.handle_trade(trade) is False
def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
patch_RPCManager(mocker)
patch_exchange(mocker)
@ -1825,7 +1832,7 @@ def test_get_real_amount_quote(default_conf, trades_for_order, buy_order_fee, ca
exchange='binance',
open_rate=0.245441,
open_order_id="123456"
)
)
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
@ -2101,9 +2108,9 @@ def test_order_book_bid_strategy2(mocker, default_conf, order_book_l2, markets)
"""
patch_exchange(mocker)
mocker.patch.multiple(
'freqtrade.exchange.Exchange',
get_markets=markets,
get_order_book=order_book_l2
'freqtrade.exchange.Exchange',
get_markets=markets,
get_order_book=order_book_l2
)
default_conf['exchange']['name'] = 'binance'
default_conf['bid_strategy']['use_order_book'] = True