summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-10 21:09:18 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-10 21:26:08 +0300
commit1a7403bb743c02a37247d0c76397cc7891fc127c (patch)
treeed310916ef0840fe5c9cd9dd877ec8aa99715a08 /tests
parent0bc15941c2d9f9b0e05fdf0e96f1a7b843912be6 (diff)
downloadmicropython-1a7403bb743c02a37247d0c76397cc7891fc127c.tar.gz
micropython-1a7403bb743c02a37247d0c76397cc7891fc127c.zip
objtype: Implement ->getiter() method for instances.
Includes support for native bases.
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/subclass_native_specmeth.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/basics/subclass_native_specmeth.py b/tests/basics/subclass_native_specmeth.py
new file mode 100644
index 0000000000..91ffc9624b
--- /dev/null
+++ b/tests/basics/subclass_native_specmeth.py
@@ -0,0 +1,18 @@
+# Test calling non-special method inherited from native type
+
+class mylist(list):
+ pass
+
+l = mylist([1, 2, 3])
+print(l)
+print([e for e in l])
+
+
+class mylist2(list):
+
+ def __iter__(self):
+ return iter([10, 20, 30])
+
+l = mylist2([1, 2, 3])
+print(l)
+print([e for e in l])