diff --git a/tests/wild/subtpl.liq b/tests/wild/subtpl.liq new file mode 100644 index 0000000..89759ae --- /dev/null +++ b/tests/wild/subtpl.liq @@ -0,0 +1 @@ +|{{ variable }}| \ No newline at end of file diff --git a/tests/wild/test_include.py b/tests/wild/test_include.py new file mode 100644 index 0000000..af048fb --- /dev/null +++ b/tests/wild/test_include.py @@ -0,0 +1,29 @@ +from liquid import Liquid +from pathlib import Path + +def test_include(set_default_wild): + subtpl = Path(__file__).parent.joinpath("subtpl.liq") + + # default + tpl = f""" + {{% assign variable = 8525 %}} + {{% include "{subtpl}" %}} + """ + out = Liquid(tpl).render().strip() + assert out == "|8525|" + + # with context + tpl = f""" + {{% assign variable = 8525 %}} + {{% include "{subtpl}" with context %}} + """ + out = Liquid(tpl).render().strip() + assert out == "|8525|" + + # without context + tpl = f""" + {{% assign variable = 8525 %}} + {{% include "{subtpl}" without context %}} + """ + out = Liquid(tpl).render().strip() + assert out == "||"