gh-81682: Fix test failures when CPython is built without docstrings (GH-113410)

This commit is contained in:
Serhiy Storchaka 2023-12-23 11:56:30 +02:00 committed by GitHub
parent c3f92f6a75
commit 4e5b27e6a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 55 additions and 21 deletions

View file

@ -7,6 +7,7 @@ import textwrap
import types
import re
from idlelib.idle_test.mock_tk import Text
from test.support import MISSING_C_DOCSTRINGS
# Test Class TC is used in multiple get_argspec test methods
@ -50,6 +51,8 @@ class Get_argspecTest(unittest.TestCase):
# but a red buildbot is better than a user crash (as has happened).
# For a simple mismatch, change the expected output to the actual.
@unittest.skipIf(MISSING_C_DOCSTRINGS,
"Signature information for builtins requires docstrings")
def test_builtins(self):
def tiptest(obj, out):
@ -143,6 +146,8 @@ you\'ll probably have to override _wrap_chunks().''')
f.__doc__ = 'a'*300
self.assertEqual(get_spec(f), f"()\n{'a'*(calltip._MAX_COLS-3) + '...'}")
@unittest.skipIf(MISSING_C_DOCSTRINGS,
"Signature information for builtins requires docstrings")
def test_multiline_docstring(self):
# Test fewer lines than max.
self.assertEqual(get_spec(range),
@ -157,6 +162,7 @@ bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
bytes(int) -> bytes object of size given by the parameter initialized with null bytes
bytes() -> empty bytes object''')
def test_multiline_docstring_2(self):
# Test more than max lines
def f(): pass
f.__doc__ = 'a\n' * 15