]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Added a test for generator_stop
authorArmin Ronacher <armin.ronacher@active-4.com>
Wed, 28 Dec 2016 08:51:01 +0000 (09:51 +0100)
committerArmin Ronacher <armin.ronacher@active-4.com>
Wed, 28 Dec 2016 08:51:01 +0000 (09:51 +0100)
tests/test_features.py [new file with mode: 0644]

diff --git a/tests/test_features.py b/tests/test_features.py
new file mode 100644 (file)
index 0000000..25d58e4
--- /dev/null
@@ -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())