diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-10-15 12:40:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-15 12:40:02 +0100 |
commit | f3ef06a7cb347ab7bd3cc2b0b3dcebe4f9ff36f9 (patch) | |
tree | 14fd293892933aadf389040db8e2be63cab4abf6 /Lib/test/test_inspect.py | |
parent | eb1dda2b56f67f09352c303588c28880c471ae87 (diff) | |
download | cpython-git-f3ef06a7cb347ab7bd3cc2b0b3dcebe4f9ff36f9.tar.gz |
bpo-38478: Correctly handle keyword argument with same name as positional-only parameter (GH-16800)
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r-- | Lib/test/test_inspect.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 9d28d5ad57..d95e742c8d 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -3573,6 +3573,16 @@ class TestSignatureBind(unittest.TestCase): iterator = iter(range(5)) self.assertEqual(self.call(setcomp_func, iterator), {0, 1, 4, 9, 16}) + def test_signature_bind_posonly_kwargs(self): + def foo(bar, /, **kwargs): + return bar, kwargs.get(bar) + + sig = inspect.signature(foo) + result = sig.bind("pos-only", bar="keyword") + + self.assertEqual(result.kwargs, {"bar": "keyword"}) + self.assertIn(("bar", "pos-only"), result.arguments.items()) + class TestBoundArguments(unittest.TestCase): def test_signature_bound_arguments_unhashable(self): |