diff options
| author | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-14 22:47:17 (GMT) |
|---|---|---|
| committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-14 22:47:17 (GMT) |
| commit | 3f6538fed0e2e8905805f3d30937cd41d26e032b (patch) | |
| tree | ad3a0855c22a5ae0098f442c87d513429a27d8b1 /Lib/test/test_inspect.py | |
| parent | 6b4046f062760a26d7668b0f56ae34adf6cfcf2d (diff) | |
| download | cpython-3f6538fed0e2e8905805f3d30937cd41d26e032b.zip cpython-3f6538fed0e2e8905805f3d30937cd41d26e032b.tar.gz cpython-3f6538fed0e2e8905805f3d30937cd41d26e032b.tar.bz2 | |
Issue 22547: Implement informative __repr__ for inspect.BoundArguments
Diffstat (limited to 'Lib/test/test_inspect.py')
| -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 bbb7afa..6f813be 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -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): |
