import sys
+import types
from ast import literal_eval
from itertools import islice, chain
from jinja2 import nodes
if not head:
return None
+ if isinstance(nodes, types.GeneratorType):
+ nodes = chain(head, nodes)
+
if len(head) == 1:
out = head[0]
else:
- out = u''.join([text_type(v) for v in chain(head, nodes)])
+ out = u''.join([text_type(v) for v in nodes])
try:
return literal_eval(out)
result = t.render()
assert not isinstance(result, type)
assert result in ["<type 'bool'>", "<class 'bool'>"]
+
+ def test_string(self, env):
+ t = env.from_string("[{{ 'all' }}]")
+ result = t.render()
+ assert isinstance(result, text_type)
+ assert result == "[all]"