diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2019-05-06 22:40:27 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-06 22:40:27 +0300 |
| commit | d53cf99dca4605ace4b81b1e585616b3e1b74fa6 (patch) | |
| tree | 0cce690e90a722457d3f472f1a7c4e471182e2bc /Lib/test/test_inspect.py | |
| parent | 96aeaec64738b730c719562125070a52ed570210 (diff) | |
| download | cpython-git-d53cf99dca4605ace4b81b1e585616b3e1b74fa6.tar.gz | |
bpo-36542: Allow to overwrite the signature for Python functions. (GH-12705)
Diffstat (limited to 'Lib/test/test_inspect.py')
| -rw-r--r-- | Lib/test/test_inspect.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 3c825b00e5..c54cdb23c2 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -3782,6 +3782,17 @@ class TestSignatureDefinitions(unittest.TestCase): with self.subTest(builtin=name): self.assertIsNone(obj.__text_signature__) + def test_python_function_override_signature(self): + def func(*args, **kwargs): + pass + func.__text_signature__ = '($self, a, b=1, *args, c, d=2, **kwargs)' + sig = inspect.signature(func) + self.assertIsNotNone(sig) + self.assertEqual(str(sig), '(self, /, a, b=1, *args, c, d=2, **kwargs)') + func.__text_signature__ = '($self, a, b=1, /, *args, c, d=2, **kwargs)' + sig = inspect.signature(func) + self.assertEqual(str(sig), '(self, a, b=1, /, *args, c, d=2, **kwargs)') + class NTimesUnwrappable: def __init__(self, n): |
