From e1a2860013ae64e727635efa997ad2bb3901a5aa Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 13 May 2016 16:25:07 -0400 Subject: [PATCH] Test for class decorator See https://github.com/rocky/python-uncompyle6/pull/15 --- test/bytecode_2.7/10_classdec.pyc | Bin 0 -> 961 bytes test/simple_source/def/10_classdec.py | 27 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 test/bytecode_2.7/10_classdec.pyc create mode 100644 test/simple_source/def/10_classdec.py diff --git a/test/bytecode_2.7/10_classdec.pyc b/test/bytecode_2.7/10_classdec.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3abe91dfc83f1578b10916496c8edfa359ec9de GIT binary patch literal 961 zcmbVK!A=`75FN)!%0iHkDj{*>ROM9Yg7GAt#fB;3LmZB>+{SU|$E3{xJ2$TDLC}c(GlafaT9FIqqfIo6W zU>oXDa8B>24<*qI8kU{;8a@no z)kqh9g*{$D{3j^PVGO?0SirL8n>buk-CLoOn{g*}_csHAF+uaW0j49`3 zFyf$1< N5u409J=If3*$a}zuFe1e literal 0 HcmV?d00001 diff --git a/test/simple_source/def/10_classdec.py b/test/simple_source/def/10_classdec.py new file mode 100644 index 00000000..812ed203 --- /dev/null +++ b/test/simple_source/def/10_classdec.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# See https://github.com/rocky/python-uncompyle6/pull/15 + +# In Python 2.7, you should see +# mkfuncdeco0 ::= mkfunc +# classdefdeco2 ::= LOAD_CONST expr mkfunc CALL_FUNCTION_0 BUILD_CLASS +# classdefdeco1 ::= expr classdefdeco1 CALL_FUNCTION_1 +# designator ::= STORE_NAME +# classdefdeco ::= classdefdeco1 designator + +def author(*author_names): + def author_func(cls): + return cls + return author_func + +@author('Me', 'Him') +@author('You') +class MyClass(object): + def __init__(self): + pass + + @staticmethod + @staticmethod + def static_method(): + pass + +x = MyClass()