Skip to content

Commit 7e8578c

Browse files
[3.11] gh-115264: Fix test_functools with -00 mode (GH-115276) (#116706)
gh-115264: Fix `test_functools` with `-00` mode (GH-115276) (cherry picked from commit 27df81d) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 0ebc792 commit 7e8578c

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
@@ -2604,7 +2604,10 @@ def static_func(arg: int) -> str:
26042604
A().static_func
26052605
):
26062606
with self.subTest(meth=meth):
2607-
self.assertEqual(meth.__doc__, 'My function docstring')
2607+
self.assertEqual(meth.__doc__,
2608+
('My function docstring'
2609+
if support.HAVE_DOCSTRINGS
2610+
else None))
26082611
self.assertEqual(meth.__annotations__['arg'], int)
26092612

26102613
self.assertEqual(A.func.__name__, 'func')
@@ -2693,7 +2696,10 @@ def decorated_classmethod(cls, arg: int) -> str:
26932696
WithSingleDispatch().decorated_classmethod
26942697
):
26952698
with self.subTest(meth=meth):
2696-
self.assertEqual(meth.__doc__, 'My function docstring')
2699+
self.assertEqual(meth.__doc__,
2700+
('My function docstring'
2701+
if support.HAVE_DOCSTRINGS
2702+
else None))
26972703
self.assertEqual(meth.__annotations__['arg'], int)
26982704

26992705
self.assertEqual(
@@ -3057,7 +3063,10 @@ def test_access_from_class(self):
30573063
self.assertIsInstance(CachedCostItem.cost, py_functools.cached_property)
30583064

30593065
def test_doc(self):
3060-
self.assertEqual(CachedCostItem.cost.__doc__, "The cost of the item.")
3066+
self.assertEqual(CachedCostItem.cost.__doc__,
3067+
("The cost of the item."
3068+
if support.HAVE_DOCSTRINGS
3069+
else None))
30613070

30623071

30633072
if __name__ == '__main__':

0 commit comments

Comments
 (0)