summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_super.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-05-27 08:17:07 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-05-27 08:17:07 (GMT)
commit0b43bcf5287d9494e3332b391350fcd32fe93f2c (patch)
tree4afedcf7ea32b14bb3c9a46fb8fd9532e9344bd0 /Lib/test/test_super.py
parent5c6eba3a93ce5fe989e372a8b12f535c72fc4e8f (diff)
downloadcpython-0b43bcf5287d9494e3332b391350fcd32fe93f2c.zip
cpython-0b43bcf5287d9494e3332b391350fcd32fe93f2c.tar.gz
cpython-0b43bcf5287d9494e3332b391350fcd32fe93f2c.tar.bz2
Close #14857: fix regression in references to PEP 3135 implicit __class__ closure variable. Reopens issue #12370, but also updates unittest.mock to workaround that issue
Diffstat (limited to 'Lib/test/test_super.py')
-rw-r--r--Lib/test/test_super.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py
index 298cae0..32eb1c0 100644
--- a/Lib/test/test_super.py
+++ b/Lib/test/test_super.py
@@ -81,6 +81,7 @@ class TestSuper(unittest.TestCase):
self.assertEqual(E().f(), 'AE')
+ @unittest.expectedFailure
def test___class___set(self):
# See issue #12370
class X(A):
@@ -91,6 +92,29 @@ class TestSuper(unittest.TestCase):
self.assertEqual(x.f(), 'A')
self.assertEqual(x.__class__, 413)
+ def test___class___instancemethod(self):
+ # See issue #14857
+ class X:
+ def f(self):
+ return __class__
+ self.assertIs(X().f(), X)
+
+ def test___class___classmethod(self):
+ # See issue #14857
+ class X:
+ @classmethod
+ def f(cls):
+ return __class__
+ self.assertIs(X.f(), X)
+
+ def test___class___staticmethod(self):
+ # See issue #14857
+ class X:
+ @staticmethod
+ def f():
+ return __class__
+ self.assertIs(X.f(), X)
+
def test_main():
support.run_unittest(TestSuper)