diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2016-12-28 09:51:01 +0100 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2016-12-28 09:51:01 +0100 |
commit | 17f73a87017e2f2e99808f5f6ba81c76f18e8aca (patch) | |
tree | 7bba02f15ebd9206d1bb3202200a55255de173b0 | |
parent | 61f39a9cd45bdd7529a0299a05d5ab6eb5412f2b (diff) | |
download | jinja2-17f73a87017e2f2e99808f5f6ba81c76f18e8aca.tar.gz |
Added a test for generator_stop
-rw-r--r-- | tests/test_features.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_features.py b/tests/test_features.py new file mode 100644 index 0000000..25d58e4 --- /dev/null +++ b/tests/test_features.py @@ -0,0 +1,16 @@ +import sys +import pytest + +from jinja2 import Template + + +@pytest.mark.skipif(sys.version_info < (3, 5), + reason='Requires 3.5 or later') +def test_generator_stop(): + class X(object): + def __getattr__(self, name): + raise StopIteration() + + t = Template('a{{ bad.bar() }}b') + with pytest.raises(RuntimeError): + t.render(bad=X()) |