freqtrade_origin/tests/util/test_rendering_utils.py

21 lines
621 B
Python
Raw Normal View History

2023-08-15 05:42:43 +00:00
import pytest
from freqtrade.util import render_template, render_template_with_fallback
def test_render_template_fallback():
from jinja2.exceptions import TemplateNotFound
2024-05-12 13:41:07 +00:00
2023-08-15 05:42:43 +00:00
with pytest.raises(TemplateNotFound):
val = render_template(
2024-05-12 13:41:07 +00:00
templatefile="subtemplates/indicators_does-not-exist.j2",
arguments={},
)
2023-08-15 05:42:43 +00:00
val = render_template_with_fallback(
2024-05-12 13:41:07 +00:00
templatefile="strategy_subtemplates/indicators_does-not-exist.j2",
templatefallbackfile="strategy_subtemplates/indicators_minimal.j2",
2023-08-15 05:42:43 +00:00
)
assert isinstance(val, str)
2024-05-12 13:41:07 +00:00
assert "if self.dp" in val