Feat: add test on add_filter

This commit is contained in:
Bertrand Benjamin 2022-05-04 11:11:39 +02:00
parent 25b5bde823
commit 87ebb4c284
1 changed files with 9 additions and 0 deletions

View File

@ -29,3 +29,12 @@ def test_block_line_statement_with_comment():
jinja2_template = texenv.from_string(base_template)
output = jinja2_template.render()
assert output == "\n2"
def test_add_filter():
texenv.filters["count_caracters"] = lambda x: len(x)
base_template = r"""\Var{a} has \Var{a | count_caracters}"""
jinja2_template = texenv.from_string(base_template)
output = jinja2_template.render(a="coucou")
assert output == "coucou has 6"