Skip to content

Commit

Permalink
pythongh-115263: Fix test_functools with -00 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Feb 11, 2024
1 parent b70a68f commit e8633e8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Lib/test/test_functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2706,7 +2706,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 @@ -2795,7 +2798,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 @@ -3123,7 +3129,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_module(self):
self.assertEqual(CachedCostItem.cost.__module__, CachedCostItem.__module__)
Expand Down

0 comments on commit e8633e8

Please sign in to comment.