summaryrefslogtreecommitdiff
path: root/tests/basics/boundmeth1.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-03-03 16:45:39 +0000
committerDamien George <damien.p.george@gmail.com>2015-03-03 16:45:39 +0000
commit086a7616ddd1736e064aab70bf5126bf24988a45 (patch)
treed90375a372ff971c43a1ab13ead608ea1b154d68 /tests/basics/boundmeth1.py
parent25f1264699b9f718607e3e861ed6217bf490fe46 (diff)
tests: Add tests for boundmeth; and bignum cmp, unary, float, error.
Diffstat (limited to 'tests/basics/boundmeth1.py')
-rw-r--r--tests/basics/boundmeth1.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/basics/boundmeth1.py b/tests/basics/boundmeth1.py
new file mode 100644
index 000000000..a72887275
--- /dev/null
+++ b/tests/basics/boundmeth1.py
@@ -0,0 +1,24 @@
+# tests basics of bound methods
+
+# uPy and CPython differ when printing a bound method, so just print the type
+print(type(repr([].append)))
+
+class A:
+ def f(self):
+ return 0
+ def g(self, a):
+ return a
+ def h(self, a, b, c, d, e, f):
+ return a + b + c + d + e + f
+
+# bound method with no extra args
+m = A().f
+print(m())
+
+# bound method with 1 extra arg
+m = A().g
+print(m(1))
+
+# bound method with lots of extra args
+m = A().h
+print(m(1, 2, 3, 4, 5, 6))