Add test for __code__ loading

This commit is contained in:
Matthias
2020-09-17 07:38:56 +02:00
parent ba10bd7756
commit becccca3d1
4 changed files with 21 additions and 10 deletions

View File

@@ -18,13 +18,15 @@ def test_search_strategy():
s, _ = StrategyResolver._search_object(
directory=default_location,
object_name='DefaultStrategy'
object_name='DefaultStrategy',
add_source=True,
)
assert issubclass(s, IStrategy)
s, _ = StrategyResolver._search_object(
directory=default_location,
object_name='NotFoundStrategy'
object_name='NotFoundStrategy',
add_source=True,
)
assert s is None
@@ -53,6 +55,9 @@ def test_load_strategy(default_conf, result):
'strategy_path': str(Path(__file__).parents[2] / 'freqtrade/templates')
})
strategy = StrategyResolver.load_strategy(default_conf)
assert isinstance(strategy.__code__, str)
assert 'class SampleStrategy' in strategy.__code__
assert isinstance(strategy.__file__, str)
assert 'rsi' in strategy.advise_indicators(result, {'pair': 'ETH/BTC'})