From d8af0dc9c4e1c2dad1844d611e78d3b1b86b997b Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 20 May 2023 11:36:58 +0200 Subject: [PATCH] Slightly improve testcase --- tests/optimize/test_lookahead_analysis.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/optimize/test_lookahead_analysis.py b/tests/optimize/test_lookahead_analysis.py index ff6d9c7da..6872cb73a 100644 --- a/tests/optimize/test_lookahead_analysis.py +++ b/tests/optimize/test_lookahead_analysis.py @@ -5,11 +5,10 @@ from unittest.mock import MagicMock, PropertyMock import pytest -import freqtrade.commands.arguments -import freqtrade.optimize.lookahead_analysis from freqtrade.commands.optimize_commands import start_lookahead_analysis from freqtrade.data.history import get_timerange from freqtrade.exceptions import OperationalException +from freqtrade.optimize.lookahead_analysis import LookaheadAnalysis from tests.conftest import CURRENT_TEST_STRATEGY, get_args, patch_exchange @@ -21,12 +20,13 @@ def lookahead_conf(default_conf_usdt): return default_conf_usdt -def test_start_start_lookahead_analysis(mocker): +def test_start_lookahead_analysis(mocker): single_mock = MagicMock() + text_table_mock = MagicMock() mocker.patch.multiple( - 'freqtrade.optimize.lookahead_analysis.LookaheadAnalysisSubFunctions', + 'freqtrade.optimize.lookahead_analysis_helpers.LookaheadAnalysisSubFunctions', initialize_single_lookahead_analysis=single_mock, - text_table_lookahead_analysis_instances=MagicMock(), + text_table_lookahead_analysis_instances=text_table_mock, ) args = [ "lookahead-analysis", @@ -40,6 +40,7 @@ def test_start_start_lookahead_analysis(mocker): start_lookahead_analysis(pargs) assert single_mock.call_count == 1 + assert text_table_mock.call_count == 1 single_mock.reset_mock() @@ -62,7 +63,6 @@ def test_start_start_lookahead_analysis(mocker): start_lookahead_analysis(pargs) - def test_biased_strategy(lookahead_conf, mocker, caplog) -> None: mocker.patch('freqtrade.data.history.get_timerange', get_timerange) @@ -76,5 +76,5 @@ def test_biased_strategy(lookahead_conf, mocker, caplog) -> None: strategy_obj = {} strategy_obj['name'] = "strategy_test_v3_with_lookahead_bias" - freqtrade.optimize.lookahead_analysis.LookaheadAnalysis(lookahead_conf, strategy_obj) + LookaheadAnalysis(lookahead_conf, strategy_obj) pass