From 4b7dfc64c66afa33f2723be1214668b16f42f327 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 16 Jun 2019 14:03:55 +0200 Subject: [PATCH] Add test for generate_plot_file --- freqtrade/plot/plotting.py | 1 - freqtrade/tests/test_plotting.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/freqtrade/plot/plotting.py b/freqtrade/plot/plotting.py index b1e32c4fb..dcea3291f 100644 --- a/freqtrade/plot/plotting.py +++ b/freqtrade/plot/plotting.py @@ -1,7 +1,6 @@ import logging from typing import List -import arrow import pandas as pd from pathlib import Path diff --git a/freqtrade/tests/test_plotting.py b/freqtrade/tests/test_plotting.py index e264ef6b3..b1dad5d5c 100644 --- a/freqtrade/tests/test_plotting.py +++ b/freqtrade/tests/test_plotting.py @@ -32,6 +32,7 @@ def generage_empty_figure(): vertical_spacing=0.0001, ) + def test_generate_row(default_conf, caplog): pair = "UNITTEST/BTC" timerange = TimeRange(None, 'line', 0, -1000) @@ -155,3 +156,14 @@ def test_generate_graph_no_trades(default_conf, mocker): assert row_mock.call_count == 2 assert trades_mock.call_count == 1 + + +def test_generate_plot_file(mocker, caplog): + fig = generage_empty_figure() + plot_mock = mocker.patch("freqtrade.plot.plotting.plot", MagicMock()) + generate_plot_file(fig, "UNITTEST/BTC", "5m") + + assert plot_mock.call_count == 1 + assert plot_mock.call_args[0][0] == fig + assert (plot_mock.call_args_list[0][1]['filename'] + == "user_data/plots/freqtrade-plot-UNITTEST_BTC-5m.html")