summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_grammar.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-02-23 15:01:05 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-02-23 15:01:05 (GMT)
commit5224d28d38eb784f17c2fed3f48368285df6d17a (patch)
treeb258202efc39ae5239d91dcf5b1898c6ce713f16 /Lib/test/test_grammar.py
parentb12f0b581a6f268d0611c87012d1273aeca220b8 (diff)
downloadcpython-5224d28d38eb784f17c2fed3f48368285df6d17a.zip
cpython-5224d28d38eb784f17c2fed3f48368285df6d17a.tar.gz
cpython-5224d28d38eb784f17c2fed3f48368285df6d17a.tar.bz2
Patch #1759: Backport of PEP 3129 class decorators
with some help from Georg
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r--Lib/test/test_grammar.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index d4bcfda..e2bb3eb 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -779,6 +779,16 @@ hello world
def meth1(self): pass
def meth2(self, arg): pass
def meth3(self, a1, a2): pass
+ # decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE
+ # decorators: decorator+
+ # decorated: decorators (classdef | funcdef)
+ def class_decorator(x):
+ x.decorated = True
+ return x
+ @class_decorator
+ class G:
+ pass
+ self.assertEqual(G.decorated, True)
def testListcomps(self):
# list comprehension tests