summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-26 23:35:13 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-27 00:11:36 +0200
commite9137b94f27594ea1bdeb5fa4eaddffcbb7b9e9a (patch)
treec14b5aea484651e297487f3612ac14b899b57bf9 /tests
parent9b196cddab80e24b9ce66b1c922cb757b11fb16a (diff)
downloadmicropython-e9137b94f27594ea1bdeb5fa4eaddffcbb7b9e9a.tar.gz
micropython-e9137b94f27594ea1bdeb5fa4eaddffcbb7b9e9a.zip
py: Implement getattr() builtin.
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/getattr1.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/basics/getattr1.py b/tests/basics/getattr1.py
new file mode 100644
index 0000000000..7b7e073922
--- /dev/null
+++ b/tests/basics/getattr1.py
@@ -0,0 +1,15 @@
+class A:
+
+ var = 132
+
+ def __init__(self):
+ self.var2 = 34
+
+ def meth(self, i):
+ return 42 + i
+
+
+a = A()
+print(getattr(a, "var"))
+print(getattr(a, "var2"))
+print(getattr(a, "meth")(5))