Skip to content

Commit 96c7604

Browse files
[3.12] gh-115264: Fix test_functools with -00 mode (GH-115276) (#116707)
gh-115264: Fix `test_functools` with `-00` mode (GH-115276) (cherry picked from commit 27df81d) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent d0c32ae commit 96c7604

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
@@ -2618,7 +2618,10 @@ def static_func(arg: int) -> str:
26182618
A().static_func
26192619
):
26202620
with self.subTest(meth=meth):
2621-
self.assertEqual(meth.__doc__, 'My function docstring')
2621+
self.assertEqual(meth.__doc__,
2622+
('My function docstring'
2623+
if support.HAVE_DOCSTRINGS
2624+
else None))
26222625
self.assertEqual(meth.__annotations__['arg'], int)
26232626

26242627
self.assertEqual(A.func.__name__, 'func')
@@ -2707,7 +2710,10 @@ def decorated_classmethod(cls, arg: int) -> str:
27072710
WithSingleDispatch().decorated_classmethod
27082711
):
27092712
with self.subTest(meth=meth):
2710-
self.assertEqual(meth.__doc__, 'My function docstring')
2713+
self.assertEqual(meth.__doc__,
2714+
('My function docstring'
2715+
if support.HAVE_DOCSTRINGS
2716+
else None))
27112717
self.assertEqual(meth.__annotations__['arg'], int)
27122718

27132719
self.assertEqual(
@@ -3035,7 +3041,10 @@ def test_access_from_class(self):
30353041
self.assertIsInstance(CachedCostItem.cost, py_functools.cached_property)
30363042

30373043
def test_doc(self):
3038-
self.assertEqual(CachedCostItem.cost.__doc__, "The cost of the item.")
3044+
self.assertEqual(CachedCostItem.cost.__doc__,
3045+
("The cost of the item."
3046+
if support.HAVE_DOCSTRINGS
3047+
else None))
30393048

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

0 commit comments

Comments
 (0)