Skip to content
Merged
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
15 changes: 12 additions & 3 deletions Lib/test/test_functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2618,7 +2618,10 @@ def static_func(arg: int) -> str:
A().static_func
):
with self.subTest(meth=meth):
self.assertEqual(meth.__doc__, 'My function docstring')
self.assertEqual(meth.__doc__,
('My function docstring'
if support.HAVE_DOCSTRINGS
else None))
self.assertEqual(meth.__annotations__['arg'], int)

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

self.assertEqual(
Expand Down Expand Up @@ -3035,7 +3041,10 @@ def test_access_from_class(self):
self.assertIsInstance(CachedCostItem.cost, py_functools.cached_property)

def test_doc(self):
self.assertEqual(CachedCostItem.cost.__doc__, "The cost of the item.")
self.assertEqual(CachedCostItem.cost.__doc__,
("The cost of the item."
if support.HAVE_DOCSTRINGS
else None))

def test_subclass_with___set__(self):
"""Caching still works for a subclass defining __set__."""
Expand Down