summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/fun_name.py
diff options
context:
space:
mode:
authorstijn <stinos@zoho.com>2015-02-14 18:44:31 +0100
committerDamien George <damien.p.george@gmail.com>2015-03-20 23:13:32 +0000
commit3cc17c69ffd64dca55fe613f6e931585d8893c0d (patch)
tree73fe88917c5b65ac3fdb679e5aee7338ed2fa66b /tests/basics/fun_name.py
parent07b8dc68d667c212f9a3710b74e90e05e1032316 (diff)
downloadmicropython-3cc17c69ffd64dca55fe613f6e931585d8893c0d.tar.gz
micropython-3cc17c69ffd64dca55fe613f6e931585d8893c0d.zip
py: Allow retrieving a function's __name__.
Disabled by default. Enabled on unix and stmhal ports.
Diffstat (limited to 'tests/basics/fun_name.py')
-rw-r--r--tests/basics/fun_name.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/basics/fun_name.py b/tests/basics/fun_name.py
new file mode 100644
index 0000000000..a7f9c60968
--- /dev/null
+++ b/tests/basics/fun_name.py
@@ -0,0 +1,16 @@
+def Fun():
+ pass
+
+class A:
+ def __init__(self):
+ pass
+ def Fun(self):
+ pass
+
+try:
+ print(Fun.__name__)
+ print(A.__init__.__name__)
+ print(A.Fun.__name__)
+ print(A().Fun.__name__)
+except AttributeError:
+ print('SKIP')