mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Issue 22547: Implement informative __repr__ for inspect.BoundArguments
This commit is contained in:
parent
6b4046f062
commit
3f6538fed0
3 changed files with 17 additions and 0 deletions
|
|
@ -3149,6 +3149,13 @@ class TestBoundArguments(unittest.TestCase):
|
|||
ba_pickled = pickle.loads(pickle.dumps(ba, ver))
|
||||
self.assertEqual(ba, ba_pickled)
|
||||
|
||||
def test_signature_bound_arguments_repr(self):
|
||||
def foo(a, b, *, c:1={}, **kw) -> {42:'ham'}: pass
|
||||
sig = inspect.signature(foo)
|
||||
ba = sig.bind(20, 30, z={})
|
||||
self.assertRegex(repr(ba),
|
||||
r'<BoundArguments at 0x[a-fA-F0-9]+ \(a=20,.*\}\}\)>')
|
||||
|
||||
|
||||
class TestSignaturePrivateHelpers(unittest.TestCase):
|
||||
def test_signature_get_bound_param(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue