summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-02-18 17:49:41 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2014-02-18 17:49:41 (GMT)
commit026019f89bf6669593d458dfa3ad9fc7b8d78bc2 (patch)
treea8d346de9c8006259fe7879d7c1b60aab62cca18 /Lib/test/test_inspect.py
parentee227ae7cf1f88e865c168a8f13743e92ade1938 (diff)
downloadcpython-026019f89bf6669593d458dfa3ad9fc7b8d78bc2.zip
cpython-026019f89bf6669593d458dfa3ad9fc7b8d78bc2.tar.gz
cpython-026019f89bf6669593d458dfa3ad9fc7b8d78bc2.tar.bz2
Mangle __parameters in __annotations__ dict properly. Issue #20625.
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r--Lib/test/test_inspect.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 3f20419..a34a418 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -2390,6 +2390,22 @@ class TestSignatureObject(unittest.TestCase):
self.assertEqual(sig.return_annotation, 42)
self.assertEqual(sig, inspect.signature(test))
+ def test_signature_on_mangled_parameters(self):
+ class Spam:
+ def foo(self, __p1:1=2, *, __p2:2=3):
+ pass
+ class Ham(Spam):
+ pass
+
+ self.assertEqual(self.signature(Spam.foo),
+ ((('self', ..., ..., "positional_or_keyword"),
+ ('_Spam__p1', 2, 1, "positional_or_keyword"),
+ ('_Spam__p2', 3, 2, "keyword_only")),
+ ...))
+
+ self.assertEqual(self.signature(Spam.foo),
+ self.signature(Ham.foo))
+
class TestParameterObject(unittest.TestCase):
def test_signature_parameter_kinds(self):