MCPcopy
hub / github.com/pallets/jinja / test_iterator_not_advanced_early

Function test_iterator_not_advanced_early

tests/test_runtime.py:58–65  ·  tests/test_runtime.py::test_iterator_not_advanced_early
()

Source from the content-addressed store, hash-verified

56
57
58def test_iterator_not_advanced_early():
59 t = Template(class="st">"{% for _, g in gs %}{{ loop.index }} {{ g|list }}\n{% endfor %}")
60 out = t.render(
61 gs=itertools.groupby([(1, class="st">"a"), (1, class="st">"b"), (2, class="st">"c"), (3, class="st">"d")], lambda x: x[0])
62 )
63 class="cm"># groupby groups depend on the current position of the iterator. If
64 class="cm"># it was advanced early, the lists would appear empty.
65 assert out == class="st">"1 [(1, &class="cm">#x27;a'), (1, 'b')]\n2 [(2, 'c')]\n3 [(3, 'd')]\n"
66
67
68def test_mock_not_pass_arg_marker():

Callers

nothing calls this directly

Calls 2

renderMethod · 0.95
TemplateClass · 0.90

Tested by

no test coverage detected