diff genshi/template/tests/eval.py @ 583:60a906b93acd stable-0.4.x

Ported [696] to 0.4.x branch.
author cmlenz
date Wed, 01 Aug 2007 16:23:41 +0000
parents e9e1239960f5
children 587910938507
line wrap: on
line diff
--- a/genshi/template/tests/eval.py
+++ b/genshi/template/tests/eval.py
@@ -549,6 +549,16 @@
 x = foo()""").execute(d)
         self.assertEqual(2, d['x'])
 
+    def test_augmented_assign_in_loop_in_def(self):
+        d = {}
+        Suite("""def foo():
+    i = 0
+    for n in range(5):
+        i += n
+    return i
+x = foo()""").execute(d)
+        self.assertEqual(10, d['x'])
+
     def test_assign_in_list(self):
         suite = Suite("[d['k']] = 'foo',; assert d['k'] == 'foo'")
         d = {"k": "bar"}
Copyright (C) 2012-2017 Edgewall Software