diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2016-03-02 16:07:47 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2016-03-02 16:07:47 (GMT) |
commit | f9e1f2bda930054eed3115e19e9f3f7bfc83c1b6 (patch) | |
tree | 8b021183fe8aa457ab0c74d5d409525e4f8b543e /Lib/test | |
parent | 1bd030788d1092ba5d5d8b4e2fd75346ded69b3b (diff) | |
download | cpython-f9e1f2bda930054eed3115e19e9f3f7bfc83c1b6.zip cpython-f9e1f2bda930054eed3115e19e9f3f7bfc83c1b6.tar.gz cpython-f9e1f2bda930054eed3115e19e9f3f7bfc83c1b6.tar.bz2 |
inspect: Fix BoundArguments.apply_defaults to handle empty arguments
Patch by Frederick Wagner (issue #26347)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_inspect.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 69ddb51..671e05a 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -3324,6 +3324,13 @@ class TestBoundArguments(unittest.TestCase): ba.apply_defaults() self.assertEqual(list(ba.arguments.items()), []) + # Make sure a no-args binding still acquires proper defaults. + def foo(a='spam'): pass + sig = inspect.signature(foo) + ba = sig.bind() + ba.apply_defaults() + self.assertEqual(list(ba.arguments.items()), [('a', 'spam')]) + class TestSignaturePrivateHelpers(unittest.TestCase): def test_signature_get_bound_param(self): |