Skip to content

Commit 27df81d

Browse files
authored
gh-115264: Fix test_functools with -00 mode (#115276)
1 parent 43986f5 commit 27df81d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Lib/test/test_functools.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,7 +2696,10 @@ def static_func(arg: int) -> str:
26962696
A().static_func
26972697
):
26982698
with self.subTest(meth=meth):
2699-
self.assertEqual(meth.__doc__, 'My function docstring')
2699+
self.assertEqual(meth.__doc__,
2700+
('My function docstring'
2701+
if support.HAVE_DOCSTRINGS
2702+
else None))
27002703
self.assertEqual(meth.__annotations__['arg'], int)
27012704

27022705
self.assertEqual(A.func.__name__, 'func')
@@ -2785,7 +2788,10 @@ def decorated_classmethod(cls, arg: int) -> str:
27852788
WithSingleDispatch().decorated_classmethod
27862789
):
27872790
with self.subTest(meth=meth):
2788-
self.assertEqual(meth.__doc__, 'My function docstring')
2791+
self.assertEqual(meth.__doc__,
2792+
('My function docstring'
2793+
if support.HAVE_DOCSTRINGS
2794+
else None))
27892795
self.assertEqual(meth.__annotations__['arg'], int)
27902796

27912797
self.assertEqual(
@@ -3128,7 +3134,10 @@ def test_access_from_class(self):
31283134
self.assertIsInstance(CachedCostItem.cost, py_functools.cached_property)
31293135

31303136
def test_doc(self):
3131-
self.assertEqual(CachedCostItem.cost.__doc__, "The cost of the item.")
3137+
self.assertEqual(CachedCostItem.cost.__doc__,
3138+
("The cost of the item."
3139+
if support.HAVE_DOCSTRINGS
3140+
else None))
31323141

31333142
def test_module(self):
31343143
self.assertEqual(CachedCostItem.cost.__module__, CachedCostItem.__module__)

0 commit comments

Comments
 (0)