

def test_context_vars(self):
    tmpl = env.from_string('{% for item in seq -%}\n        {{ loop.index }}|{{ loop.index0 }}|{{ loop.revindex }}|{{\n            loop.revindex0 }}|{{ loop.first }}|{{ loop.last }}|{{\n           loop.length }}###{% endfor %}')
    (one, two, _) = tmpl.render(seq=[0, 1]).split('###')
    (one_index, one_index0, one_revindex, one_revindex0, one_first, one_last, one_length) = one.split('|')
    (two_index, two_index0, two_revindex, two_revindex0, two_first, two_last, two_length) = two.split('|')
    assert ((int(one_index) == 1) and (int(one_revindex0) == 2))
    assert ((int(one_index0) == 0) and (int(two_index0) == 1))
    assert ((int(one_revindex) == 2) and (int(two_revindex) == 1))
    assert ((int(one_revindex0) == 1) and (int(two_revindex0) == 0))
    assert ((one_first == 'True') and (two_first == 'False'))
    assert ((one_last == 'False') and (two_last == 'True'))
    assert (one_length == two_length == '2')

dataset/ETHPy150Open GeekTrainer/Flask/Work/Trivia - Module 5/env/Lib/site-packages/jinja2/testsuite/core_tags.py ForLoopTestCase.test_context_vars/VarMisuse@105/230 `two_index`->`one_revindex0`