| 250 | pytest.raises(TemplateSyntaxError, Template, "{% for x in %}..{% endfor %}") |
| 251 | |
| 252 | def test_recursive_loop_compile(self, env): |
| 253 | Template( |
| 254 | """ |
| 255 | {% for p in foo recursive%} |
| 256 | {{p.bar}} |
| 257 | {% for f in p.fields recursive%} |
| 258 | {{f.baz}} |
| 259 | {{p.bar}} |
| 260 | {% if f.rec %} |
| 261 | {{ loop(f.sub) }} |
| 262 | {% endif %} |
| 263 | {% endfor %} |
| 264 | {% endfor %} |
| 265 | """ |
| 266 | ) |
| 267 | Template( |
| 268 | """ |
| 269 | {% for p in foo%} |
| 270 | {{p.bar}} |
| 271 | {% for f in p.fields recursive%} |
| 272 | {{f.baz}} |
| 273 | {{p.bar}} |
| 274 | {% if f.rec %} |
| 275 | {{ loop(f.sub) }} |
| 276 | {% endif %} |
| 277 | {% endfor %} |
| 278 | {% endfor %} |
| 279 | """ |
| 280 | ) |
| 281 | |
| 282 | def test_else_loop_bug(self, env): |
| 283 | t = Template( |