mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +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))
|
int))
|
||||||
|
|
||||||
def test_signature_on_classmethod(self):
|
def test_signature_on_classmethod(self):
|
||||||
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
self.assertEqual(self.signature(classmethod),
|
self.assertEqual(self.signature(classmethod),
|
||||||
((('function', ..., ..., "positional_only"),),
|
((('function', ..., ..., "positional_only"),),
|
||||||
...))
|
...))
|
||||||
|
@ -3434,6 +3435,7 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
...))
|
...))
|
||||||
|
|
||||||
def test_signature_on_staticmethod(self):
|
def test_signature_on_staticmethod(self):
|
||||||
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
self.assertEqual(self.signature(staticmethod),
|
self.assertEqual(self.signature(staticmethod),
|
||||||
((('function', ..., ..., "positional_only"),),
|
((('function', ..., ..., "positional_only"),),
|
||||||
...))
|
...))
|
||||||
|
@ -3954,6 +3956,7 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
|
|
||||||
self.assertEqual(C(3), 8)
|
self.assertEqual(C(3), 8)
|
||||||
self.assertEqual(C(3, 7), 1)
|
self.assertEqual(C(3, 7), 1)
|
||||||
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
# BUG: Returns '<Signature (b)>'
|
# BUG: Returns '<Signature (b)>'
|
||||||
with self.assertRaises(AssertionError):
|
with self.assertRaises(AssertionError):
|
||||||
self.assertEqual(self.signature(C), self.signature((0).__pow__))
|
self.assertEqual(self.signature(C), self.signature((0).__pow__))
|
||||||
|
@ -4352,6 +4355,7 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
__call__ = (2).__pow__
|
__call__ = (2).__pow__
|
||||||
|
|
||||||
self.assertEqual(C()(3), 8)
|
self.assertEqual(C()(3), 8)
|
||||||
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
self.assertEqual(self.signature(C()), self.signature((0).__pow__))
|
self.assertEqual(self.signature(C()), self.signature((0).__pow__))
|
||||||
|
|
||||||
with self.subTest('ClassMethodDescriptorType'):
|
with self.subTest('ClassMethodDescriptorType'):
|
||||||
|
@ -4361,6 +4365,7 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
res = C()([1, 2], 3)
|
res = C()([1, 2], 3)
|
||||||
self.assertEqual(res, {1: 3, 2: 3})
|
self.assertEqual(res, {1: 3, 2: 3})
|
||||||
self.assertEqual(type(res), C)
|
self.assertEqual(type(res), C)
|
||||||
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
self.assertEqual(self.signature(C()), self.signature(dict.fromkeys))
|
self.assertEqual(self.signature(C()), self.signature(dict.fromkeys))
|
||||||
|
|
||||||
with self.subTest('MethodDescriptorType'):
|
with self.subTest('MethodDescriptorType'):
|
||||||
|
@ -4375,6 +4380,7 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
__call__ = int.__pow__
|
__call__ = int.__pow__
|
||||||
|
|
||||||
self.assertEqual(C(2)(3), 8)
|
self.assertEqual(C(2)(3), 8)
|
||||||
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
self.assertEqual(self.signature(C()), self.signature((0).__pow__))
|
self.assertEqual(self.signature(C()), self.signature((0).__pow__))
|
||||||
|
|
||||||
with self.subTest('MemberDescriptorType'):
|
with self.subTest('MemberDescriptorType'):
|
||||||
|
@ -4393,6 +4399,7 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
def __call__(self, *args, **kwargs):
|
def __call__(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
self.assertEqual(self.signature(C), ((), ...))
|
self.assertEqual(self.signature(C), ((), ...))
|
||||||
self.assertEqual(self.signature(C()),
|
self.assertEqual(self.signature(C()),
|
||||||
((('a', ..., ..., "positional_only"),
|
((('a', ..., ..., "positional_only"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue