diff genshi/template/tests/eval.py @ 804:cce33406c1cf stable-0.5.x

Ported [1005] to 0.5.x branch.
author cmlenz
date Thu, 05 Mar 2009 10:06:45 +0000
parents c690de5abafd
children a134e21a8f44
line wrap: on
line diff
--- a/genshi/template/tests/eval.py
+++ b/genshi/template/tests/eval.py
@@ -581,6 +581,18 @@
         suite.execute(data)
         self.assertEqual([0, 1, 4], data['x'])
 
+    def test_for_in_def(self):
+        suite = Suite("""def loop():
+    for i in range(10):
+        if i == 5:
+            break
+    return i
+""")
+        data = {}
+        suite.execute(data)
+        assert 'loop' in data
+        self.assertEqual(5, data['loop']())
+
     def test_if(self):
         suite = Suite("""if foo == 42:
     x = True
Copyright (C) 2012-2017 Edgewall Software