some more test

This commit is contained in:
Christof 2020-12-19 21:47:11 +01:00
parent c1b8ad7232
commit 3cb559994e

View File

@ -107,6 +107,10 @@ def test_add_areas(default_conf, testdatadir, caplog):
"fill_to": "macdhist", "fill_to": "macdhist",
"fill_label": "MACD Fill"}} "fill_label": "MACD Fill"}}
ind_no_label = {"macd": {"fill_color": "red",
"fill_to": "macdhist"}}
ind_plain = {"macd": {"fill_to": "macdhist"}}
default_conf.update({'strategy': 'DefaultStrategy'}) default_conf.update({'strategy': 'DefaultStrategy'})
strategy = StrategyResolver.load_strategy(default_conf) strategy = StrategyResolver.load_strategy(default_conf)
@ -124,6 +128,7 @@ def test_add_areas(default_conf, testdatadir, caplog):
assert fig == fig2 assert fig == fig2
assert log_has_re(r'Indicator "no_indicator" ignored\..*', caplog) assert log_has_re(r'Indicator "no_indicator" ignored\..*', caplog)
# everythin given in plot config, row 3
fig3 = add_areas(fig, 3, data, indicators) fig3 = add_areas(fig, 3, data, indicators)
figure = fig3.layout.figure figure = fig3.layout.figure
fill_macd = find_trace_in_fig_data(figure.data, "MACD Fill") fill_macd = find_trace_in_fig_data(figure.data, "MACD Fill")
@ -131,6 +136,21 @@ def test_add_areas(default_conf, testdatadir, caplog):
assert fill_macd.yaxis == "y3" assert fill_macd.yaxis == "y3"
assert fill_macd.fillcolor == "black" assert fill_macd.fillcolor == "black"
# label missing, row 1
fig4 = add_areas(fig, 1, data, ind_no_label)
figure = fig4.layout.figure
fill_macd = find_trace_in_fig_data(figure.data, "macd<>macdhist")
assert isinstance(fill_macd, go.Scatter)
assert fill_macd.yaxis == "y"
assert fill_macd.fillcolor == "red"
# fit_to only
fig5 = add_areas(fig, 1, data, ind_plain)
figure = fig5.layout.figure
fill_macd = find_trace_in_fig_data(figure.data, "macd<>macdhist")
assert isinstance(fill_macd, go.Scatter)
assert fill_macd.yaxis == "y"
def test_plot_trades(testdatadir, caplog): def test_plot_trades(testdatadir, caplog):
fig1 = generate_empty_figure() fig1 = generate_empty_figure()