summaryrefslogtreecommitdiff
path: root/tests/basics
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics')
-rw-r--r--tests/basics/fun_calldblstar4.py33
-rw-r--r--tests/basics/python34.py1
-rw-r--r--tests/basics/python34.py.exp1
3 files changed, 33 insertions, 2 deletions
diff --git a/tests/basics/fun_calldblstar4.py b/tests/basics/fun_calldblstar4.py
new file mode 100644
index 000000000..acb332a8c
--- /dev/null
+++ b/tests/basics/fun_calldblstar4.py
@@ -0,0 +1,33 @@
+# test calling a function with multiple **args
+
+
+def f(a, b=None, c=None):
+ print(a, b, c)
+
+
+f(**{"a": 1}, **{"b": 2})
+f(**{"a": 1}, **{"b": 2}, c=3)
+f(**{"a": 1}, b=2, **{"c": 3})
+
+try:
+ f(1, **{"b": 2}, **{"b": 3})
+except TypeError:
+ print("TypeError")
+
+# test calling a method with multiple **args
+
+
+class A:
+ def f(self, a, b=None, c=None):
+ print(a, b, c)
+
+
+a = A()
+a.f(**{"a": 1}, **{"b": 2})
+a.f(**{"a": 1}, **{"b": 2}, c=3)
+a.f(**{"a": 1}, b=2, **{"c": 3})
+
+try:
+ a.f(1, **{"b": 2}, **{"b": 3})
+except TypeError:
+ print("TypeError")
diff --git a/tests/basics/python34.py b/tests/basics/python34.py
index 0f6e4bafd..609a8b6b8 100644
--- a/tests/basics/python34.py
+++ b/tests/basics/python34.py
@@ -25,7 +25,6 @@ def test_syntax(code):
except SyntaxError:
print("SyntaxError")
test_syntax("f(*a, *b)") # can't have multiple * (in 3.5 we can)
-test_syntax("f(**a, **b)") # can't have multiple ** (in 3.5 we can)
test_syntax("f(*a, b)") # can't have positional after *
test_syntax("f(**a, b)") # can't have positional after **
test_syntax("() = []") # can't assign to empty tuple (in 3.6 we can)
diff --git a/tests/basics/python34.py.exp b/tests/basics/python34.py.exp
index 848017130..75f1c2c05 100644
--- a/tests/basics/python34.py.exp
+++ b/tests/basics/python34.py.exp
@@ -8,7 +8,6 @@ SyntaxError
SyntaxError
SyntaxError
SyntaxError
-SyntaxError
3.4
3 4
IndexError('foo',)