Make flake happy

This commit is contained in:
hroff-1902 2019-09-10 12:37:15 +03:00
parent e298e77319
commit 2081d7552f
2 changed files with 14 additions and 8 deletions

View File

@ -211,7 +211,7 @@ class Trade(_DECL_BASE):
def __repr__(self):
open_since = (f"{arrow.get(self.open_date).strftime('%Y-%m-%d %H:%M:%S')} "
f"({arrow.get(self.open_date).humanize()})" ) if self.is_open else 'closed'
f"({arrow.get(self.open_date).humanize()})") if self.is_open else 'closed'
return (f'Trade(id={self.id}, pair={self.pair}, amount={self.amount:.8f}, '
f'open_rate={self.open_rate:.8f}, open_since={open_since})')

View File

@ -1823,7 +1823,8 @@ def test_handle_trade_roi(default_conf, ticker, limit_buy_order,
# if ROI is reached we must sell
patch_get_signal(freqtrade, value=(False, True))
assert freqtrade.handle_trade(trade)
assert log_has("'ETH/BTC' - Required profit reached. Selling (sell_type=SellType.ROI)...", caplog)
assert log_has("'ETH/BTC' - Required profit reached. Selling (sell_type=SellType.ROI)...",
caplog)
def test_handle_trade_experimental(
@ -1853,7 +1854,8 @@ def test_handle_trade_experimental(
patch_get_signal(freqtrade, value=(False, True))
assert freqtrade.handle_trade(trade)
assert log_has("'ETH/BTC' - Sell signal received. Selling (sell_type=SellType.SELL_SIGNAL)...", caplog)
assert log_has("'ETH/BTC' - Sell signal received. Selling (sell_type=SellType.SELL_SIGNAL)...",
caplog)
def test_close_trade(default_conf, ticker, limit_buy_order, limit_sell_order,
@ -2149,9 +2151,11 @@ def test_check_handle_timedout_exception(default_conf, ticker, mocker, caplog) -
Trade.session.add(trade_buy)
freqtrade.check_handle_timedout()
assert log_has_re(f"Cannot query order for Trade\(id=1, pair=ETH/BTC, amount=90.99181073, "
f"open_rate=0.00001099, open_since={open_date.strftime('%Y-%m-%d %H:%M:%S')} "
f"\(10 hours ago\)\) due to Traceback \(most recent call last\):\n*", caplog)
assert log_has_re(f"Cannot query order for Trade\\(id=1, pair=ETH/BTC, amount=90.99181073, "
f"open_rate=0.00001099, open_since="
f"{open_date.strftime('%Y-%m-%d %H:%M:%S')} "
f"\\(10 hours ago\\)\\) due to Traceback \\(most recent call last\\):\n*",
caplog)
def test_handle_timedout_limit_buy(mocker, default_conf) -> None:
@ -2896,7 +2900,8 @@ def test_trailing_stop_loss_offset(default_conf, limit_buy_order, fee,
}))
# stop-loss not reached, adjusted stoploss
assert freqtrade.handle_trade(trade) is False
assert log_has(f"'ETH/BTC' - Using positive stoploss: 0.01 offset: 0.011 profit: 0.2666%", caplog)
assert log_has(f"'ETH/BTC' - Using positive stoploss: 0.01 offset: 0.011 profit: 0.2666%",
caplog)
assert log_has(f"'ETH/BTC' - Adjusting stoploss...", caplog)
assert trade.stop_loss == 0.0000138501
@ -2974,7 +2979,8 @@ def test_tsl_only_offset_reached(default_conf, limit_buy_order, fee,
}))
assert freqtrade.handle_trade(trade) is False
assert log_has(f"'ETH/BTC' - Using positive stoploss: 0.05 offset: 0.055 profit: 0.1218%", caplog)
assert log_has(f"'ETH/BTC' - Using positive stoploss: 0.05 offset: 0.055 profit: 0.1218%",
caplog)
assert log_has(f"'ETH/BTC' - Adjusting stoploss...", caplog)
assert trade.stop_loss == 0.0000117705