load_pair_history should not return None, but an empty dataframe if no
data is found
This commit is contained in:
@@ -74,8 +74,8 @@ def test_load_data_30min_ticker(mocker, caplog, default_conf, testdatadir) -> No
|
||||
|
||||
def test_load_data_7min_ticker(mocker, caplog, default_conf, testdatadir) -> None:
|
||||
ld = history.load_pair_history(pair='UNITTEST/BTC', timeframe='7m', datadir=testdatadir)
|
||||
assert not isinstance(ld, DataFrame)
|
||||
assert ld is None
|
||||
assert isinstance(ld, DataFrame)
|
||||
assert ld.empty
|
||||
assert log_has(
|
||||
'No history data for pair: "UNITTEST/BTC", timeframe: 7m. '
|
||||
'Use `freqtrade download-data` to download the data', caplog
|
||||
|
@@ -494,7 +494,7 @@ def test_backtesting_start_no_data(default_conf, mocker, caplog, testdatadir) ->
|
||||
def get_timeframe(input1):
|
||||
return Arrow(2017, 11, 14, 21, 17), Arrow(2017, 11, 14, 22, 59)
|
||||
|
||||
mocker.patch('freqtrade.data.history.load_pair_history', MagicMock(return_value=None))
|
||||
mocker.patch('freqtrade.data.history.load_pair_history', MagicMock(return_value=pd.DataFrame()))
|
||||
mocker.patch('freqtrade.data.history.get_timeframe', get_timeframe)
|
||||
mocker.patch('freqtrade.exchange.Exchange.refresh_latest_ohlcv', MagicMock())
|
||||
patch_exchange(mocker)
|
||||
|
@@ -249,7 +249,7 @@ def test_start(mocker, default_conf, caplog) -> None:
|
||||
|
||||
def test_start_no_data(mocker, default_conf, caplog) -> None:
|
||||
patched_configuration_load_config_file(mocker, default_conf)
|
||||
mocker.patch('freqtrade.data.history.load_pair_history', MagicMock(return_value=None))
|
||||
mocker.patch('freqtrade.data.history.load_pair_history', MagicMock(return_value=pd.DataFrame))
|
||||
mocker.patch(
|
||||
'freqtrade.optimize.hyperopt.get_timeframe',
|
||||
MagicMock(return_value=(datetime(2017, 12, 10), datetime(2017, 12, 13)))
|
||||
|
Reference in New Issue
Block a user