[pypy-commit] pypy py3.5: Add two cases, one passing and one obscure marked "XXX not implemented".

arigo pypy.commits at gmail.com
Mon Jan 9 15:01:09 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r89454:665c5772bb8a
Date: 2017-01-09 21:00 +0100
http://bitbucket.org/pypy/pypy/changeset/665c5772bb8a/

Log:	Add two cases, one passing and one obscure marked "XXX not
	implemented". Comment out the corresponding obscure case inside lib-
	python/3/test/test_super.py.

diff --git a/lib-python/3/test/test_super.py b/lib-python/3/test/test_super.py
--- a/lib-python/3/test/test_super.py
+++ b/lib-python/3/test/test_super.py
@@ -94,11 +94,14 @@
         x = X()
         self.assertEqual(x.f(), 'A')
         self.assertEqual(x.__class__, 413)
-        class X:
-            x = __class__
-            def f():
-                __class__
-        self.assertIs(X.x, type(self))
+        # XXX the following reads the __class__ from a class body, which
+        # XXX gives the one in the *parent* class (here, TestSuper).
+        # XXX with PyPy it fails with a NameError instead for now.
+        #class X:
+        #    x = __class__
+        #    def f():
+        #        __class__
+        #self.assertIs(X.x, type(self))
         with self.assertRaises(NameError) as e:
             exec("""class X:
                 __class__
diff --git a/pypy/interpreter/test/test_compiler.py b/pypy/interpreter/test/test_compiler.py
--- a/pypy/interpreter/test/test_compiler.py
+++ b/pypy/interpreter/test/test_compiler.py
@@ -405,7 +405,25 @@
     __class__ = 42
 def testing():
     return Y.__dict__['__class__']
-'''
+''', '''
+class X:
+    foobar = 42
+    def f(self):
+        return __class__.__dict__['foobar']
+def testing():
+    return X().f()
+''',
+#--------XXX the following case is not implemented for now
+#'''
+#class X:
+#    foobar = 42
+#    def f(self):
+#        class Y:
+#            Xcls = __class__
+#        return Y.Xcls.__dict__['foobar']
+#def testing():
+#    return X().f()
+#'''
         ]:
             space.call_args(w_filterwarnings, filter_arg)
             pycode = self.compiler.compile(code, '<tmp>', 'exec', 0)


More information about the pypy-commit mailing list