test_features.py 274 B

1234567891011121314
  1. import pytest
  2. from jinja2 import Template
  3. # Python < 3.7
  4. def test_generator_stop():
  5. class X:
  6. def __getattr__(self, name):
  7. raise StopIteration()
  8. t = Template("a{{ bad.bar() }}b")
  9. with pytest.raises(RuntimeError):
  10. t.render(bad=X())