Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,8 +1332,8 @@ def _check_docstrings():
sys.platform != 'win32' and
not sysconfig.get_config_var('WITH_DOC_STRINGS'))

HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None and
not MISSING_C_DOCSTRINGS)
HAVE_PY_DOCSTRINGS = _check_docstrings.__doc__ is not None
HAVE_DOCSTRINGS = (HAVE_PY_DOCSTRINGS and not MISSING_C_DOCSTRINGS)

requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
"test requires docstrings")
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2952,7 +2952,7 @@ def static_func(arg: int) -> str:
self.assertEqual(meth.__qualname__, prefix + meth.__name__)
self.assertEqual(meth.__doc__,
('My function docstring'
if support.HAVE_DOCSTRINGS
if support.HAVE_PY_DOCSTRINGS
else None))
self.assertEqual(meth.__annotations__['arg'], int)

Expand Down Expand Up @@ -3107,7 +3107,7 @@ def decorated_classmethod(cls, arg: int) -> str:
with self.subTest(meth=meth):
self.assertEqual(meth.__doc__,
('My function docstring'
if support.HAVE_DOCSTRINGS
if support.HAVE_PY_DOCSTRINGS
else None))
self.assertEqual(meth.__annotations__['arg'], int)

Expand Down Expand Up @@ -3584,7 +3584,7 @@ def test_access_from_class(self):
def test_doc(self):
self.assertEqual(CachedCostItem.cost.__doc__,
("The cost of the item."
if support.HAVE_DOCSTRINGS
if support.HAVE_PY_DOCSTRINGS
else None))

def test_module(self):
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,20 +636,23 @@ def test_dunder_is_original(self):
if dunder:
self.assertIs(dunder, orig)

@support.requires_docstrings
def test_attrgetter_signature(self):
operator = self.module
sig = inspect.signature(operator.attrgetter)
self.assertEqual(str(sig), '(attr, /, *attrs)')
sig = inspect.signature(operator.attrgetter('x', 'z', 'y'))
self.assertEqual(str(sig), '(obj, /)')

@support.requires_docstrings
def test_itemgetter_signature(self):
operator = self.module
sig = inspect.signature(operator.itemgetter)
self.assertEqual(str(sig), '(item, /, *items)')
sig = inspect.signature(operator.itemgetter(2, 3, 5))
self.assertEqual(str(sig), '(obj, /)')

@support.requires_docstrings
def test_methodcaller_signature(self):
operator = self.module
sig = inspect.signature(operator.methodcaller)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix compilation process with ``--enable-optimizations`` and
``--without-docstrings``.
Loading