Replace occurances in test files

This commit is contained in:
Matthias
2020-06-01 20:47:27 +02:00
parent b2c241e607
commit 950f358982
14 changed files with 57 additions and 48 deletions

View File

@@ -54,12 +54,12 @@ def test_returns_latest_signal(mocker, default_conf, ohlcv_history):
def test_get_signal_empty(default_conf, mocker, caplog):
assert (False, False) == _STRATEGY.get_signal('foo', default_conf['ticker_interval'],
assert (False, False) == _STRATEGY.get_signal('foo', default_conf['timeframe'],
DataFrame())
assert log_has('Empty candle (OHLCV) data for pair foo', caplog)
caplog.clear()
assert (False, False) == _STRATEGY.get_signal('bar', default_conf['ticker_interval'],
assert (False, False) == _STRATEGY.get_signal('bar', default_conf['timeframe'],
[])
assert log_has('Empty candle (OHLCV) data for pair bar', caplog)
@@ -70,7 +70,7 @@ def test_get_signal_exception_valueerror(default_conf, mocker, caplog, ohlcv_his
_STRATEGY, '_analyze_ticker_internal',
side_effect=ValueError('xyz')
)
assert (False, False) == _STRATEGY.get_signal('foo', default_conf['ticker_interval'],
assert (False, False) == _STRATEGY.get_signal('foo', default_conf['timeframe'],
ohlcv_history)
assert log_has_re(r'Strategy caused the following exception: xyz.*', caplog)
@@ -83,7 +83,7 @@ def test_get_signal_empty_dataframe(default_conf, mocker, caplog, ohlcv_history)
)
mocker.patch.object(_STRATEGY, 'assert_df')
assert (False, False) == _STRATEGY.get_signal('xyz', default_conf['ticker_interval'],
assert (False, False) == _STRATEGY.get_signal('xyz', default_conf['timeframe'],
ohlcv_history)
assert log_has('Empty dataframe for pair xyz', caplog)
@@ -104,7 +104,7 @@ def test_get_signal_old_dataframe(default_conf, mocker, caplog, ohlcv_history):
return_value=mocked_history
)
mocker.patch.object(_STRATEGY, 'assert_df')
assert (False, False) == _STRATEGY.get_signal('xyz', default_conf['ticker_interval'],
assert (False, False) == _STRATEGY.get_signal('xyz', default_conf['timeframe'],
ohlcv_history)
assert log_has('Outdated history for pair xyz. Last tick is 16 minutes old', caplog)
@@ -124,7 +124,7 @@ def test_assert_df_raise(default_conf, mocker, caplog, ohlcv_history):
_STRATEGY, 'assert_df',
side_effect=StrategyError('Dataframe returned...')
)
assert (False, False) == _STRATEGY.get_signal('xyz', default_conf['ticker_interval'],
assert (False, False) == _STRATEGY.get_signal('xyz', default_conf['timeframe'],
ohlcv_history)
assert log_has('Unable to analyze candle (OHLCV) data for pair xyz: Dataframe returned...',
caplog)

View File

@@ -106,7 +106,7 @@ def test_strategy(result, default_conf):
assert default_conf['stoploss'] == -0.10
assert strategy.ticker_interval == '5m'
assert default_conf['ticker_interval'] == '5m'
assert default_conf['timeframe'] == '5m'
df_indicators = strategy.advise_indicators(result, metadata=metadata)
assert 'adx' in df_indicators
@@ -176,19 +176,19 @@ def test_strategy_override_trailing_stop_positive(caplog, default_conf):
caplog)
def test_strategy_override_ticker_interval(caplog, default_conf):
def test_strategy_override_timeframe(caplog, default_conf):
caplog.set_level(logging.INFO)
default_conf.update({
'strategy': 'DefaultStrategy',
'ticker_interval': 60,
'timeframe': 60,
'stake_currency': 'ETH'
})
strategy = StrategyResolver.load_strategy(default_conf)
assert strategy.ticker_interval == 60
assert strategy.stake_currency == 'ETH'
assert log_has("Override strategy 'ticker_interval' with value in config file: 60.",
assert log_has("Override strategy 'timeframe' with value in config file: 60.",
caplog)