From 937f5e3d0fe87c4c5dc78e4f883afc6a501e776a Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 4 Jan 2022 16:48:23 +0100 Subject: [PATCH] No longer use legacy mode for tests --- tests/optimize/test_hyperopt.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/optimize/test_hyperopt.py b/tests/optimize/test_hyperopt.py index 30514a934..8aa1e66f6 100644 --- a/tests/optimize/test_hyperopt.py +++ b/tests/optimize/test_hyperopt.py @@ -1,5 +1,5 @@ # pragma pylint: disable=missing-docstring,W0212,C0103 -from datetime import datetime +from datetime import datetime, timedelta from pathlib import Path from unittest.mock import ANY, MagicMock @@ -25,12 +25,26 @@ from tests.conftest import (get_args, log_has, log_has_re, patch_exchange, def generate_result_metrics(): return { 'trade_count': 1, + 'total_trades': 1, 'avg_profit': 0.1, 'total_profit': 0.001, - 'profit': 1.0, - 'duration': 20.0 + 'profit': 0.01, + 'duration': 20.0, + 'wins': 1, + 'draws': 0, + 'losses': 0, + 'profit_mean': 0.01, + 'profit_total_abs': 0.001, + 'profit_total': 0.01, + 'holding_avg': timedelta(minutes=20), + 'max_drawdown': 0.001, + 'max_drawdown_abs': 0.001, + 'loss': 0.001, + 'is_initial_point': 0.001, + 'is_best': 1, } + def test_setup_hyperopt_configuration_without_arguments(mocker, default_conf, caplog) -> None: patched_configuration_load_config_file(mocker, default_conf) @@ -240,7 +254,7 @@ def test_log_results_if_loss_improves(hyperopt, capsys) -> None: ) out, err = capsys.readouterr() assert all(x in out - for x in ["Best", "2/2", " 1", "0.10%", "0.00100000 BTC (1.00%)", "20.0 m"]) + for x in ["Best", "2/2", " 1", "0.10%", "0.00100000 BTC (1.00%)", "00:20:00"]) def test_no_log_if_loss_does_not_improve(hyperopt, caplog) -> None: