3232from test .support import threading_helper
3333from test .support import (reap_children , captured_output , captured_stdout ,
3434 captured_stderr , is_emscripten , is_wasi ,
35- requires_docstrings )
35+ requires_docstrings , MISSING_C_DOCSTRINGS )
3636from test .support .os_helper import (TESTFN , rmtree , unlink )
3737from test import pydoc_mod
3838
@@ -906,12 +906,13 @@ class A(builtins.object)
906906 | ----------------------------------------------------------------------
907907 | Data descriptors defined here:
908908 |
909- | __dict__
910- | dictionary for instance variables
909+ | __dict__%s
911910 |
912- | __weakref__
913- | list of weak references to the object
914- ''' % __name__ )
911+ | __weakref__%s
912+ ''' % (__name__ ,
913+ '' if MISSING_C_DOCSTRINGS else '\n | dictionary for instance variables' ,
914+ '' if MISSING_C_DOCSTRINGS else '\n | list of weak references to the object' ,
915+ ))
915916
916917 def func (
917918 arg1 : Callable [[Annotated [int , 'Some doc' ]], str ],
@@ -1154,13 +1155,15 @@ def test_generic_alias(self):
11541155 doc = pydoc .render_doc (typing .List [int ], renderer = pydoc .plaintext )
11551156 self .assertIn ('_GenericAlias in module typing' , doc )
11561157 self .assertIn ('List = class list(object)' , doc )
1157- self .assertIn (list .__doc__ .strip ().splitlines ()[0 ], doc )
1158+ if not MISSING_C_DOCSTRINGS :
1159+ self .assertIn (list .__doc__ .strip ().splitlines ()[0 ], doc )
11581160
11591161 self .assertEqual (pydoc .describe (list [int ]), 'GenericAlias' )
11601162 doc = pydoc .render_doc (list [int ], renderer = pydoc .plaintext )
11611163 self .assertIn ('GenericAlias in module builtins' , doc )
11621164 self .assertIn ('\n class list(object)' , doc )
1163- self .assertIn (list .__doc__ .strip ().splitlines ()[0 ], doc )
1165+ if not MISSING_C_DOCSTRINGS :
1166+ self .assertIn (list .__doc__ .strip ().splitlines ()[0 ], doc )
11641167
11651168 def test_union_type (self ):
11661169 self .assertEqual (pydoc .describe (typing .Union [int , str ]), '_UnionGenericAlias' )
@@ -1174,7 +1177,8 @@ def test_union_type(self):
11741177 doc = pydoc .render_doc (int | str , renderer = pydoc .plaintext )
11751178 self .assertIn ('UnionType in module types object' , doc )
11761179 self .assertIn ('\n class UnionType(builtins.object)' , doc )
1177- self .assertIn (types .UnionType .__doc__ .strip ().splitlines ()[0 ], doc )
1180+ if not MISSING_C_DOCSTRINGS :
1181+ self .assertIn (types .UnionType .__doc__ .strip ().splitlines ()[0 ], doc )
11781182
11791183 def test_special_form (self ):
11801184 self .assertEqual (pydoc .describe (typing .NoReturn ), '_SpecialForm' )
@@ -1327,13 +1331,15 @@ def test_bound_builtin_classmethod_o(self):
13271331 "__class_getitem__(object, /) method of builtins.type instance" )
13281332
13291333 @support .cpython_only
1334+ @requires_docstrings
13301335 def test_module_level_callable_unrepresentable_default (self ):
13311336 import _testcapi
13321337 builtin = _testcapi .func_with_unrepresentable_signature
13331338 self .assertEqual (self ._get_summary_line (builtin ),
13341339 "func_with_unrepresentable_signature(a, b=<x>)" )
13351340
13361341 @support .cpython_only
1342+ @requires_docstrings
13371343 def test_builtin_staticmethod_unrepresentable_default (self ):
13381344 self .assertEqual (self ._get_summary_line (str .maketrans ),
13391345 "maketrans(x, y=<unrepresentable>, z=<unrepresentable>, /)" )
@@ -1343,6 +1349,7 @@ def test_builtin_staticmethod_unrepresentable_default(self):
13431349 "staticmeth(a, b=<x>)" )
13441350
13451351 @support .cpython_only
1352+ @requires_docstrings
13461353 def test_unbound_builtin_method_unrepresentable_default (self ):
13471354 self .assertEqual (self ._get_summary_line (dict .pop ),
13481355 "pop(self, key, default=<unrepresentable>, /)" )
@@ -1352,6 +1359,7 @@ def test_unbound_builtin_method_unrepresentable_default(self):
13521359 "meth(self, /, a, b=<x>)" )
13531360
13541361 @support .cpython_only
1362+ @requires_docstrings
13551363 def test_bound_builtin_method_unrepresentable_default (self ):
13561364 self .assertEqual (self ._get_summary_line ({}.pop ),
13571365 "pop(key, default=<unrepresentable>, /) "
@@ -1363,6 +1371,7 @@ def test_bound_builtin_method_unrepresentable_default(self):
13631371 "method of _testcapi.DocStringUnrepresentableSignatureTest instance" )
13641372
13651373 @support .cpython_only
1374+ @requires_docstrings
13661375 def test_unbound_builtin_classmethod_unrepresentable_default (self ):
13671376 import _testcapi
13681377 cls = _testcapi .DocStringUnrepresentableSignatureTest
@@ -1371,6 +1380,7 @@ def test_unbound_builtin_classmethod_unrepresentable_default(self):
13711380 "classmeth(type, /, a, b=<x>)" )
13721381
13731382 @support .cpython_only
1383+ @requires_docstrings
13741384 def test_bound_builtin_classmethod_unrepresentable_default (self ):
13751385 import _testcapi
13761386 cls = _testcapi .DocStringUnrepresentableSignatureTest
0 commit comments