diff --git a/freqtrade/tests/optimize/test_optimize.py b/freqtrade/tests/optimize/test_optimize.py index b58c92d5c..d73f31ad5 100644 --- a/freqtrade/tests/optimize/test_optimize.py +++ b/freqtrade/tests/optimize/test_optimize.py @@ -57,7 +57,8 @@ def test_load_data_30min_ticker(ticker_history, mocker, caplog, default_conf) -> mocker.patch('freqtrade.exchange.Exchange.get_history', return_value=ticker_history) file = os.path.join(os.path.dirname(__file__), '..', 'testdata', 'UNITTEST_BTC-30m.json') _backup_file(file, copy_file=True) - optimize.load_data(None, pairs=['UNITTEST/BTC'], ticker_interval='30m') + ld = optimize.load_data(None, pairs=['UNITTEST/BTC'], ticker_interval='30m') + assert isinstance(ld, dict) assert os.path.isfile(file) is True assert not log_has('Download the pair: "UNITTEST/BTC", Interval: 30m', caplog.record_tuples) _clean_test_file(file) diff --git a/freqtrade/tests/strategy/test_interface.py b/freqtrade/tests/strategy/test_interface.py index fedd355af..79c485590 100644 --- a/freqtrade/tests/strategy/test_interface.py +++ b/freqtrade/tests/strategy/test_interface.py @@ -179,6 +179,10 @@ def test_analyze_ticker_skip_analyze(ticker_history, mocker, caplog) -> None: strategy.process_only_new_candles = True ret = strategy.analyze_ticker(ticker_history, {'pair': 'ETH/BTC'}) + assert 'high' in ret.columns + assert 'low' in ret.columns + assert 'close' in ret.columns + assert isinstance(ret, DataFrame) assert ind_mock.call_count == 1 assert buy_mock.call_count == 1 assert buy_mock.call_count == 1 @@ -193,8 +197,8 @@ def test_analyze_ticker_skip_analyze(ticker_history, mocker, caplog) -> None: assert buy_mock.call_count == 1 assert buy_mock.call_count == 1 # only skipped analyze adds buy and sell columns, otherwise it's all mocked - assert 'buy' in ret - assert 'sell' in ret + assert 'buy' in ret.columns + assert 'sell' in ret.columns assert ret['buy'].sum() == 0 assert ret['sell'].sum() == 0 assert not log_has('TA Analysis Launched', caplog.record_tuples) diff --git a/freqtrade/tests/test_dataframe.py b/freqtrade/tests/test_dataframe.py deleted file mode 100644 index 6afb83a3f..000000000 --- a/freqtrade/tests/test_dataframe.py +++ /dev/null @@ -1,32 +0,0 @@ -# pragma pylint: disable=missing-docstring, C0103 - -import pandas - -from freqtrade.optimize import load_data -from freqtrade.resolvers import StrategyResolver - -_pairs = ['ETH/BTC'] - - -def load_dataframe_pair(pairs, strategy): - ld = load_data(None, ticker_interval='5m', pairs=pairs) - assert isinstance(ld, dict) - assert isinstance(pairs[0], str) - dataframe = ld[pairs[0]] - - dataframe = strategy.analyze_ticker(dataframe, {'pair': pairs[0]}) - return dataframe - - -def test_dataframe_load(): - strategy = StrategyResolver({'strategy': 'DefaultStrategy'}).strategy - dataframe = load_dataframe_pair(_pairs, strategy) - assert isinstance(dataframe, pandas.core.frame.DataFrame) - - -def test_dataframe_columns_exists(): - strategy = StrategyResolver({'strategy': 'DefaultStrategy'}).strategy - dataframe = load_dataframe_pair(_pairs, strategy) - assert 'high' in dataframe.columns - assert 'low' in dataframe.columns - assert 'close' in dataframe.columns