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,9 +3412,10 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
int))
|
int))
|
||||||
|
|
||||||
def test_signature_on_classmethod(self):
|
def test_signature_on_classmethod(self):
|
||||||
self.assertEqual(self.signature(classmethod),
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
((('function', ..., ..., "positional_only"),),
|
self.assertEqual(self.signature(classmethod),
|
||||||
...))
|
((('function', ..., ..., "positional_only"),),
|
||||||
|
...))
|
||||||
|
|
||||||
class Test:
|
class Test:
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -3434,9 +3435,10 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
...))
|
...))
|
||||||
|
|
||||||
def test_signature_on_staticmethod(self):
|
def test_signature_on_staticmethod(self):
|
||||||
self.assertEqual(self.signature(staticmethod),
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
((('function', ..., ..., "positional_only"),),
|
self.assertEqual(self.signature(staticmethod),
|
||||||
...))
|
((('function', ..., ..., "positional_only"),),
|
||||||
|
...))
|
||||||
|
|
||||||
class Test:
|
class Test:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -3954,9 +3956,10 @@ 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)
|
||||||
# BUG: Returns '<Signature (b)>'
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
with self.assertRaises(AssertionError):
|
# BUG: Returns '<Signature (b)>'
|
||||||
self.assertEqual(self.signature(C), self.signature((0).__pow__))
|
with self.assertRaises(AssertionError):
|
||||||
|
self.assertEqual(self.signature(C), self.signature((0).__pow__))
|
||||||
|
|
||||||
class CM(type):
|
class CM(type):
|
||||||
def __new__(mcls, name, bases, dct, *, foo=1):
|
def __new__(mcls, name, bases, dct, *, foo=1):
|
||||||
|
@ -4352,7 +4355,8 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
__call__ = (2).__pow__
|
__call__ = (2).__pow__
|
||||||
|
|
||||||
self.assertEqual(C()(3), 8)
|
self.assertEqual(C()(3), 8)
|
||||||
self.assertEqual(self.signature(C()), self.signature((0).__pow__))
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
|
self.assertEqual(self.signature(C()), self.signature((0).__pow__))
|
||||||
|
|
||||||
with self.subTest('ClassMethodDescriptorType'):
|
with self.subTest('ClassMethodDescriptorType'):
|
||||||
class C(dict):
|
class C(dict):
|
||||||
|
@ -4361,7 +4365,8 @@ 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)
|
||||||
self.assertEqual(self.signature(C()), self.signature(dict.fromkeys))
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
|
self.assertEqual(self.signature(C()), self.signature(dict.fromkeys))
|
||||||
|
|
||||||
with self.subTest('MethodDescriptorType'):
|
with self.subTest('MethodDescriptorType'):
|
||||||
class C(str):
|
class C(str):
|
||||||
|
@ -4375,7 +4380,8 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
__call__ = int.__pow__
|
__call__ = int.__pow__
|
||||||
|
|
||||||
self.assertEqual(C(2)(3), 8)
|
self.assertEqual(C(2)(3), 8)
|
||||||
self.assertEqual(self.signature(C()), self.signature((0).__pow__))
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
|
self.assertEqual(self.signature(C()), self.signature((0).__pow__))
|
||||||
|
|
||||||
with self.subTest('MemberDescriptorType'):
|
with self.subTest('MemberDescriptorType'):
|
||||||
class C:
|
class C:
|
||||||
|
@ -4393,7 +4399,8 @@ class TestSignatureObject(unittest.TestCase):
|
||||||
def __call__(self, *args, **kwargs):
|
def __call__(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.assertEqual(self.signature(C), ((), ...))
|
if not support.MISSING_C_DOCSTRINGS:
|
||||||
|
self.assertEqual(self.signature(C), ((), ...))
|
||||||
self.assertEqual(self.signature(C()),
|
self.assertEqual(self.signature(C()),
|
||||||
((('a', ..., ..., "positional_only"),
|
((('a', ..., ..., "positional_only"),
|
||||||
('b', ..., ..., "positional_or_keyword"),
|
('b', ..., ..., "positional_or_keyword"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue