Add testcase for ticket #593
authorVitja Makarov <vitja.makarov@gmail.com>
Sat, 13 Nov 2010 17:39:14 +0000 (20:39 +0300)
committerVitja Makarov <vitja.makarov@gmail.com>
Sat, 13 Nov 2010 17:39:14 +0000 (20:39 +0300)
tests/bugs.txt
tests/run/decorators_T593.pyx [new file with mode: 0644]

index 5f0b87157d9bd9d179d39a3db04c8b14e3a287ac..c97798ef546fffa971a82bca8aeffc10bad24a2b 100644 (file)
@@ -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 (file)
index 0000000..39edde6
--- /dev/null
@@ -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