Lines Matching refs:from_string
41 SecurityError, env.from_string("{{ foo.foo() }}").render, foo=PrivateStuff()
43 assert env.from_string("{{ foo.bar() }}").render(foo=PrivateStuff()) == "23"
46 SecurityError, env.from_string("{{ foo._foo() }}").render, foo=PublicStuff()
48 assert env.from_string("{{ foo.bar() }}").render(foo=PublicStuff()) == "23"
49 assert env.from_string("{{ foo.__class__ }}").render(foo=42) == ""
50 assert env.from_string("{{ foo.func_code }}").render(foo=lambda: None) == ""
54 env.from_string("{{ foo.__class__.__subclasses__() }}").render,
60 pytest.raises(SecurityError, env.from_string("{{ [].append(23) }}").render)
61 pytest.raises(SecurityError, env.from_string("{{ {1:2}.clear() }}").render)
67 env.from_string,
72 env.from_string,
78 t = env.from_string(
96 tmpl = env.from_string('{{ cls|attr("__subclasses__")() }}')
106 t = env.from_string(f"{{{{ {expr} }}}}")
109 t = env.from_string(f"{{{{ {expr} }}}}")
120 t = env.from_string(f"{{{{ {expr} }}}}")
123 t = env.from_string(f"{{{{ {expr} }}}}")
131 t = env.from_string('{{ "a{0.__class__}b".format(42) }}')
136 t = env.from_string('{{ "a{0.foo}b".format({"foo": 42}) }}')
141 t = env.from_string('{{ ("a{0.__class__}b{1}"|safe).format(42, "<foo>") }}')
146 t = env.from_string('{{ ("a{0.foo}b{1}"|safe).format({"foo": 42}, "<foo>") }}')
151 t1 = env.from_string('{{ ("a{}b{}").format("foo", "42")}}')
152 t2 = env.from_string('{{ ("a{}b{}"|safe).format(42, "<foo>") }}')
160 t = env.from_string('{{ "a{x.__class__}b".format_map({"x":42}) }}')
165 t = env.from_string('{{ "a{x.foo}b".format_map({"x":{"foo": 42}}) }}')
170 t = env.from_string(