From ac511d83692939cbce0637b8f1bd301138f80c7e Mon Sep 17 00:00:00 2001 From: Vitja Makarov Date: Sat, 13 Nov 2010 20:39:14 +0300 Subject: [PATCH] Add testcase for ticket #593 --- tests/bugs.txt | 1 + tests/run/decorators_T593.pyx | 48 +++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/run/decorators_T593.pyx diff --git a/tests/bugs.txt b/tests/bugs.txt index 5f0b8715..c97798ef 100644 --- a/tests/bugs.txt +++ b/tests/bugs.txt @@ -18,6 +18,7 @@ ipow_crash_T562 pure_mode_cmethod_inheritance_T583 genexpr_iterable_lookup_T600 for_from_pyvar_loop_T601 +decorators_T593 # CPython regression tests that don't current work: pyregr.test_threadsignals diff --git a/tests/run/decorators_T593.pyx b/tests/run/decorators_T593.pyx new file mode 100644 index 00000000..39edde60 --- /dev/null +++ b/tests/run/decorators_T593.pyx @@ -0,0 +1,48 @@ +""" +>>> am_i_buggy +False +>>> Foo +False +""" +def testme(func): + try: + am_i_buggy + return True + except NameError: + return False +@testme +def am_i_buggy(): + pass + +def testclass(klass): + try: + Foo + return True + except NameError: + return False +@testclass +class Foo: + pass + +class ODict(dict): + def __init__(self): + dict.__init__(self) + self._order = [] + dict.__setitem__(self, '_order', self._order) + def __setitem__(self, key, value): + dict.__setitem__(self, key, value) + self._order.append(key) + +class Base(type): + @staticmethod + def __prepare__(*args, **kwargs): + return ODict() + +class Bar(metaclass=Base): + """ + >>> Bar._order + ['__module__', '__doc__', 'bar'] + """ + @property + def bar(self): + return 0 -- 2.26.2