Skip to content

Commit f58eb80

Browse files
committed
tests/cpydiff: Test for PEP487 __set_name__.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
1 parent 1034b17 commit f58eb80

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/cpydiff/core_class_setname.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
categories: Core,Classes
3+
description: ``__set_name__`` is not automatically called on applicable class members.
4+
cause: MicroPython does not currently implement PEP 487.
5+
workaround: Manually iterate through a class's ``__dict__`` and invoke ``__set_name__`` on its members after creating a class.
6+
"""
7+
8+
9+
class Descriptor:
10+
def __set_name__(self, owner, name):
11+
print(f"Descriptor.__set_name__({owner.__name__}, {name!r})")
12+
13+
14+
class A:
15+
x = Descriptor()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy