mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-133210: Fix test_inspect
in --without-doc-strings
mode (#133250)
This commit is contained in:
parent
e26bafd107
commit
27e011455d
1 changed files with 20 additions and 13 deletions
|
@ -3412,6 +3412,7 @@ class TestSignatureObject(unittest.TestCase):
|
|||
int))
|
||||
|
||||
def test_signature_on_classmethod(self):
|
||||
if not support.MISSING_C_DOCSTRINGS:
|
||||
self.assertEqual(self.signature(classmethod),
|
||||
((('function', ..., ..., "positional_only"),),
|
||||
...))
|
||||
|
@ -3434,6 +3435,7 @@ class TestSignatureObject(unittest.TestCase):
|
|||
...))
|
||||
|
||||
def test_signature_on_staticmethod(self):
|
||||
if not support.MISSING_C_DOCSTRINGS:
|
||||
self.assertEqual(self.signature(staticmethod),
|
||||
((('function', ..., ..., "positional_only"),),
|
||||
...))
|
||||
|
@ -3954,6 +3956,7 @@ class TestSignatureObject(unittest.TestCase):
|
|||
|
||||
self.assertEqual(C(3), 8)
|
||||
self.assertEqual(C(3, 7), 1)
|
||||
if not support.MISSING_C_DOCSTRINGS:
|
||||
# BUG: Returns '<Signature (b)>'
|
||||
with self.assertRaises(AssertionError):
|
||||
self.assertEqual(self.signature(C), self.signature((0).__pow__))
|
||||
|
@ -4352,6 +4355,7 @@ class TestSignatureObject(unittest.TestCase):
|
|||
__call__ = (2).__pow__
|
||||
|
||||
self.assertEqual(C()(3), 8)
|
||||
if not support.MISSING_C_DOCSTRINGS:
|
||||
self.assertEqual(self.signature(C()), self.signature((0).__pow__))
|
||||
|
||||
with self.subTest('ClassMethodDescriptorType'):
|
||||
|
@ -4361,6 +4365,7 @@ class TestSignatureObject(unittest.TestCase):
|
|||
res = C()([1, 2], 3)
|
||||
self.assertEqual(res, {1: 3, 2: 3})
|
||||
self.assertEqual(type(res), C)
|
||||
if not support.MISSING_C_DOCSTRINGS:
|
||||
self.assertEqual(self.signature(C()), self.signature(dict.fromkeys))
|
||||
|
||||
with self.subTest('MethodDescriptorType'):
|
||||
|
@ -4375,6 +4380,7 @@ class TestSignatureObject(unittest.TestCase):
|
|||
__call__ = int.__pow__
|
||||
|
||||
self.assertEqual(C(2)(3), 8)
|
||||
if not support.MISSING_C_DOCSTRINGS:
|
||||
self.assertEqual(self.signature(C()), self.signature((0).__pow__))
|
||||
|
||||
with self.subTest('MemberDescriptorType'):
|
||||
|
@ -4393,6 +4399,7 @@ class TestSignatureObject(unittest.TestCase):
|
|||
def __call__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
if not support.MISSING_C_DOCSTRINGS:
|
||||
self.assertEqual(self.signature(C), ((), ...))
|
||||
self.assertEqual(self.signature(C()),
|
||||
((('a', ..., ..., "positional_only"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue