tests adjusted
This commit is contained in:
parent
11dce91281
commit
7cb753754b
@ -2,12 +2,12 @@ import pytest
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade.data.btanalysis import BT_DATA_COLUMNS, load_backtest_data
|
||||
from freqtrade.data.history import make_testdata_path
|
||||
from freqtrade.data.history import make_datadir_path
|
||||
|
||||
|
||||
def test_load_backtest_data():
|
||||
|
||||
filename = make_testdata_path(None) / "backtest-result_test.json"
|
||||
filename = make_datadir_path(None) / "backtest-result_test.json"
|
||||
bt_data = load_backtest_data(filename)
|
||||
assert isinstance(bt_data, DataFrame)
|
||||
assert list(bt_data.columns) == BT_DATA_COLUMNS + ["profitabs"]
|
||||
|
@ -16,7 +16,7 @@ from freqtrade.data import history
|
||||
from freqtrade.data.history import (download_pair_history,
|
||||
load_cached_data_for_updating,
|
||||
load_tickerdata_file,
|
||||
make_testdata_path,
|
||||
make_datadir_path,
|
||||
trim_tickerlist)
|
||||
from freqtrade.misc import file_dump_json
|
||||
from freqtrade.tests.conftest import get_patched_exchange, log_has
|
||||
@ -136,7 +136,7 @@ def test_load_data_with_new_pair_1min(ticker_history_list, mocker, caplog, defau
|
||||
|
||||
|
||||
def test_testdata_path() -> None:
|
||||
assert str(Path('freqtrade') / 'tests' / 'testdata') in str(make_testdata_path(None))
|
||||
assert str(Path('freqtrade') / 'tests' / 'testdata') in str(make_datadir_path(None))
|
||||
|
||||
|
||||
def test_load_cached_data_for_updating(mocker) -> None:
|
||||
@ -321,7 +321,8 @@ def test_download_backtesting_data_exception(ticker_history, mocker, caplog, def
|
||||
_clean_test_file(file1_1)
|
||||
_clean_test_file(file1_5)
|
||||
assert log_has(
|
||||
'Failed to download history data for pair: "MEME/BTC", interval: 1m.',
|
||||
'Failed to download history data for pair: "MEME/BTC", interval: 1m. '
|
||||
'Error: File Error',
|
||||
caplog.record_tuples
|
||||
)
|
||||
|
||||
|
@ -6,7 +6,7 @@ from unittest.mock import MagicMock
|
||||
from freqtrade.data.converter import parse_ticker_dataframe
|
||||
from freqtrade.misc import (common_datearray, datesarray_to_datetimearray,
|
||||
file_dump_json, file_load_json, format_ms_time, shorten_date)
|
||||
from freqtrade.data.history import load_tickerdata_file, make_testdata_path
|
||||
from freqtrade.data.history import load_tickerdata_file, pair_data_filename
|
||||
from freqtrade.strategy.default_strategy import DefaultStrategy
|
||||
|
||||
|
||||
@ -60,13 +60,13 @@ def test_file_dump_json(mocker) -> None:
|
||||
def test_file_load_json(mocker) -> None:
|
||||
|
||||
# 7m .json does not exist
|
||||
ret = file_load_json(make_testdata_path(None).joinpath('UNITTEST_BTC-7m.json'))
|
||||
ret = file_load_json(pair_data_filename(None, 'UNITTEST/BTC', '7m'))
|
||||
assert not ret
|
||||
# 1m json exists (but no .gz exists)
|
||||
ret = file_load_json(make_testdata_path(None).joinpath('UNITTEST_BTC-1m.json'))
|
||||
ret = file_load_json(pair_data_filename(None, 'UNITTEST/BTC', '1m'))
|
||||
assert ret
|
||||
# 8 .json is empty and will fail if it's loaded. .json.gz is a copy of 1.json
|
||||
ret = file_load_json(make_testdata_path(None).joinpath('UNITTEST_BTC-8m.json'))
|
||||
ret = file_load_json(pair_data_filename(None, 'UNITTEST/BTC', '8m'))
|
||||
assert ret
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user