summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_subclassinit.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-09-21 12:54:59 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-09-21 12:54:59 (GMT)
commitafd02a439f864c8380a8554ae6cb9726b996fd5e (patch)
tree0fc8e637e3f24b4ad1de6436b5568882f411c932 /Lib/test/test_subclassinit.py
parentb00e00c339cec1438a3764001b994c0a274a49c1 (diff)
downloadcpython-afd02a439f864c8380a8554ae6cb9726b996fd5e.zip
cpython-afd02a439f864c8380a8554ae6cb9726b996fd5e.tar.gz
cpython-afd02a439f864c8380a8554ae6cb9726b996fd5e.tar.bz2
Issue #28214: Now __set_name__ is looked up on the class instead of the
instance.
Diffstat (limited to 'Lib/test/test_subclassinit.py')
-rw-r--r--Lib/test/test_subclassinit.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_subclassinit.py b/Lib/test/test_subclassinit.py
index ea6de75..0267e41 100644
--- a/Lib/test/test_subclassinit.py
+++ b/Lib/test/test_subclassinit.py
@@ -148,6 +148,18 @@ class Test(unittest.TestCase):
class A:
d = Descriptor()
+ def test_set_name_lookup(self):
+ resolved = []
+ class NonDescriptor:
+ def __getattr__(self, name):
+ resolved.append(name)
+
+ class A:
+ d = NonDescriptor()
+
+ self.assertNotIn('__set_name__', resolved,
+ '__set_name__ is looked up in instance dict')
+
def test_set_name_init_subclass(self):
class Descriptor:
def __set_name__(self, owner, name):