aboutsummaryrefslogtreecommitdiff
path: root/tests/basics
diff options
context:
space:
mode:
authorPaul Sokolovsky2014-02-16 18:30:49 +0200
committerPaul Sokolovsky2014-02-16 18:36:33 +0200
commitac2e28c6547f34d961e8b0a0ede323c9c32b5315 (patch)
tree9b6cce27c5f65d5c80ff04de9b9f9743e82e6c38 /tests/basics
parent44739e280e81c2ebf2491818eb5a6d0ef30c7c6b (diff)
Support passing positional args as keywords to bytecode functions.
For this, record argument names along with each bytecode function. The code still includes extensive debug logging support so far.
Diffstat (limited to 'tests/basics')
-rw-r--r--tests/basics/fun-kwargs.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/basics/fun-kwargs.py b/tests/basics/fun-kwargs.py
new file mode 100644
index 000000000..9f4f2b7d3
--- /dev/null
+++ b/tests/basics/fun-kwargs.py
@@ -0,0 +1,35 @@
+def f1(a):
+ print(a)
+
+f1(123)
+f1(a=123)
+try:
+ f1(b=123)
+except TypeError:
+ print("TypeError")
+
+def f2(a, b):
+ print(a, b)
+
+f2(1, 2)
+f2(a=3, b=4)
+f2(b=5, a=6)
+f2(7, b=8)
+try:
+ f2(9, a=10)
+except TypeError:
+ print("TypeError")
+
+def f3(a, b, *args):
+ print(a, b, args)
+
+
+f3(1, b=3)
+try:
+ f3(1, a=3)
+except TypeError:
+ print("TypeError")
+try:
+ f3(1, 2, 3, 4, a=5)
+except TypeError:
+ print("TypeError")