IRIS YANG | 3121357 | 2020-08-18 13:17:02 +0000 | [diff] [blame] | 1 | import pytest |
2 | |||||
3 | from jinja2 import Template | ||||
4 | |||||
5 | |||||
6 | # Python < 3.7 | ||||
7 | def test_generator_stop(): | ||||
8 | class X: | ||||
9 | def __getattr__(self, name): | ||||
10 | raise StopIteration() | ||||
11 | |||||
12 | t = Template("a{{ bad.bar() }}b") | ||||
13 | with pytest.raises(RuntimeError): | ||||
14 | t.render(bad=X()) |