summaryrefslogtreecommitdiff
path: root/Lib/test/test_extcall.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-06-01 10:42:42 +0100
committerGitHub <noreply@github.com>2020-06-01 10:42:42 +0100
commitdb64f12e4deda2abbafb6d2bd5c06762fca991ff (patch)
treecbaf24cd7eea578450bd3ea6396cf1cd4bbddf4a /Lib/test/test_extcall.py
parenta871f692b4a2e6c7d45579693e787edc0af1a02c (diff)
downloadcpython-git-db64f12e4deda2abbafb6d2bd5c06762fca991ff.tar.gz
Make sure that keyword arguments are merged into the arguments dictionary when dict unpacking and keyword arguments are interleaved. (GH-20553)
Diffstat (limited to 'Lib/test/test_extcall.py')
-rw-r--r--Lib/test/test_extcall.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py
index 1faf29e01d..4205ca8222 100644
--- a/Lib/test/test_extcall.py
+++ b/Lib/test/test_extcall.py
@@ -79,6 +79,24 @@ Here we add keyword arguments
>>> f(1, 2, 3, *(4, 5), x=6, y=7, **UserDict(a=8, b=9))
(1, 2, 3, 4, 5) {'a': 8, 'b': 9, 'x': 6, 'y': 7}
+Mix keyword arguments and dict unpacking
+
+ >>> d1 = {'a':1}
+
+ >>> d2 = {'c':3}
+
+ >>> f(b=2, **d1, **d2)
+ () {'a': 1, 'b': 2, 'c': 3}
+
+ >>> f(**d1, b=2, **d2)
+ () {'a': 1, 'b': 2, 'c': 3}
+
+ >>> f(**d1, **d2, b=2)
+ () {'a': 1, 'b': 2, 'c': 3}
+
+ >>> f(**d1, b=2, **d2, d=4)
+ () {'a': 1, 'b': 2, 'c': 3, 'd': 4}
+
Examples with invalid arguments (TypeErrors). We're also testing the function
names in the exception messages.