1import pytest 2 3from jinja2 import Template 4 5 6# Python < 3.7 7def 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()) 15