diff options
Diffstat (limited to 'tests/basics/fun-callstardblstar.py')
-rw-r--r-- | tests/basics/fun-callstardblstar.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/basics/fun-callstardblstar.py b/tests/basics/fun-callstardblstar.py new file mode 100644 index 0000000000..f2fd29107e --- /dev/null +++ b/tests/basics/fun-callstardblstar.py @@ -0,0 +1,17 @@ +# test calling a function with *tuple and **dict + +def f(a, b, c, d): + print(a, b, c, d) + +f(*(1, 2), **{'c':3, 'd':4}) +f(*(1, 2), **{['c', 'd'][i]:(3 + i) for i in range(2)}) + +# test calling a method with *tuple and **dict + +class A: + def f(self, a, b, c, d): + print(a, b, c, d) + +a = A() +a.f(*(1, 2), **{'c':3, 'd':4}) +a.f(*(1, 2), **{['c', 'd'][i]:(3 + i) for i in range(2)}) |