mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Add Appropriate test for loading error
This commit is contained in:
parent
28046c6a22
commit
9460fd8d75
|
@ -227,7 +227,16 @@ class StrategyResolver(IResolver):
|
|||
if type(strategy).populate_exit_trend == IStrategy.populate_exit_trend:
|
||||
raise OperationalException("`populate_exit_trend` must be implemented.")
|
||||
else:
|
||||
# TODO: Verify if populate_buy and populate_sell are implemented
|
||||
|
||||
if (type(strategy).populate_buy_trend == IStrategy.populate_buy_trend
|
||||
and type(strategy).populate_entry_trend == IStrategy.populate_entry_trend):
|
||||
raise OperationalException(
|
||||
"`populate_entry_trend` or `populate_buy_trend` must be implemented.")
|
||||
if (type(strategy).populate_sell_trend == IStrategy.populate_sell_trend
|
||||
and type(strategy).populate_exit_trend == IStrategy.populate_exit_trend):
|
||||
raise OperationalException(
|
||||
"`populate_exit_trend` or `populate_sell_trend` must be implemented.")
|
||||
|
||||
strategy._populate_fun_len = len(getfullargspec(strategy.populate_indicators).args)
|
||||
strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
|
||||
strategy._sell_fun_len = len(getfullargspec(strategy.populate_sell_trend).args)
|
||||
|
|
|
@ -144,6 +144,16 @@ def test_strategy_can_short(caplog, default_conf):
|
|||
assert isinstance(strat, IStrategy)
|
||||
|
||||
|
||||
def test_strategy_implements_populate_entry(caplog, default_conf):
|
||||
caplog.set_level(logging.INFO)
|
||||
default_conf.update({
|
||||
'strategy': "StrategyTestV2",
|
||||
})
|
||||
default_conf['trading_mode'] = 'futures'
|
||||
with pytest.raises(OperationalException, match="`populate_entry_trend` must be implemented."):
|
||||
StrategyResolver.load_strategy(default_conf)
|
||||
|
||||
|
||||
def test_strategy_override_minimal_roi(caplog, default_conf):
|
||||
caplog.set_level(logging.INFO)
|
||||
default_conf.update({
|
||||
|
|
Loading…
Reference in New Issue
Block a user