diff genshi/template/tests/eval.py @ 879:fe5b8e29fda8 trunk

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 eb80cbd8e4fe
children 8ae2c1765068
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