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:
|
if type(strategy).populate_exit_trend == IStrategy.populate_exit_trend:
|
||||||
raise OperationalException("`populate_exit_trend` must be implemented.")
|
raise OperationalException("`populate_exit_trend` must be implemented.")
|
||||||
else:
|
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._populate_fun_len = len(getfullargspec(strategy.populate_indicators).args)
|
||||||
strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
|
strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
|
||||||
strategy._sell_fun_len = len(getfullargspec(strategy.populate_sell_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)
|
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):
|
def test_strategy_override_minimal_roi(caplog, default_conf):
|
||||||
caplog.set_level(logging.INFO)
|
caplog.set_level(logging.INFO)
|
||||||
default_conf.update({
|
default_conf.update({
|
||||||
|
Loading…
Reference in New Issue
Block a user