From 05967442c3d03a450440d77b1df344e54f100bee Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Sun, 1 Dec 2019 18:01:59 +0300 Subject: [PATCH] Adjust test --- tests/optimize/test_hyperopt.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/optimize/test_hyperopt.py b/tests/optimize/test_hyperopt.py index 08bef11a1..ff485d423 100644 --- a/tests/optimize/test_hyperopt.py +++ b/tests/optimize/test_hyperopt.py @@ -475,7 +475,21 @@ def test_format_results(hyperopt): labels = ['currency', 'profit_percent', 'profit_abs', 'trade_duration'] df = pd.DataFrame.from_records(trades, columns=labels) results_metrics = hyperopt._calculate_results_metrics(df) - result = hyperopt._format_explanation_string(results_metrics, 1) + results_explanation = hyperopt._format_results_explanation_string(results_metrics) + total_profit = results_metrics['total_profit'] + + results = { + 'loss': 0.0, + 'params_dict': None, + 'params_details': None, + 'results_metrics': results_metrics, + 'results_explanation': results_explanation, + 'total_profit': total_profit, + 'current_epoch': 1, + 'is_initial_point': True, + } + + result = hyperopt._format_explanation_string(results, 1) assert result.find(' 66.67%') assert result.find('Total profit 1.00000000 BTC') assert result.find('2.0000Σ %') @@ -488,7 +502,8 @@ def test_format_results(hyperopt): ] df = pd.DataFrame.from_records(trades, columns=labels) results_metrics = hyperopt._calculate_results_metrics(df) - result = hyperopt._format_explanation_string(results_metrics, 1) + results['total_profit'] = results_metrics['total_profit'] + result = hyperopt._format_explanation_string(results, 1) assert result.find('Total profit 1.00000000 EUR')