| 56 | |
| 57 | |
| 58 | def 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 | |
| 68 | def test_mock_not_pass_arg_marker(): |