Remove mutable default from template-rendere

This commit is contained in:
Matthias 2024-04-19 07:24:11 +02:00
parent 298f9b225d
commit a451b94387
2 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,10 @@ Jinja2 rendering utils, used to generate new strategy and configurations.
""" """
def render_template(templatefile: str, arguments: dict = {}) -> str: from typing import Dict
def render_template(templatefile: str, arguments: Dict) -> str:
from jinja2 import Environment, PackageLoader, select_autoescape from jinja2 import Environment, PackageLoader, select_autoescape

View File

@ -7,7 +7,9 @@ def test_render_template_fallback():
from jinja2.exceptions import TemplateNotFound from jinja2.exceptions import TemplateNotFound
with pytest.raises(TemplateNotFound): with pytest.raises(TemplateNotFound):
val = render_template( val = render_template(
templatefile='subtemplates/indicators_does-not-exist.j2',) templatefile='subtemplates/indicators_does-not-exist.j2',
arguments={},
)
val = render_template_with_fallback( val = render_template_with_fallback(
templatefile='strategy_subtemplates/indicators_does-not-exist.j2', templatefile='strategy_subtemplates/indicators_does-not-exist.j2',