diff genshi/template/tests/eval.py @ 879:27d210790d27

Looks like the 'decorators' field in the AST was renamed to 'decorator_list' in Python 2.6, so look for both. See #379.
author cmlenz
date Thu, 15 Apr 2010 21:38:21 +0000
parents 9309530ee279
children 248d6671a7e1
line wrap: on
line diff
--- a/genshi/template/tests/eval.py
+++ b/genshi/template/tests/eval.py
@@ -588,6 +588,21 @@
         suite.execute(data)
         self.assertEqual(['foo', 'bar'], data['x'])
 
+    def test_def_with_decorator(self):
+        suite = Suite("""
+def lower(fun):
+    return lambda: fun().lower()
+
+@lower
+def say_hi():
+    return 'Hi!'
+
+result = say_hi()
+""")
+        data = {}
+        suite.execute(data)
+        self.assertEqual('hi!', data['result'])
+
     def test_delete(self):
         suite = Suite("""foo = 42
 del foo
Copyright (C) 2012-2017 Edgewall Software