[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 27df81d564)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2024-03-13 08:05:41 +01:00 committed by GitHub
parent 0ebc7925e5
commit 7e8578ce9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2604,7 +2604,10 @@ class TestSingleDispatch(unittest.TestCase):
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')
@ -2693,7 +2696,10 @@ class TestSingleDispatch(unittest.TestCase):
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(
@ -3057,7 +3063,10 @@ class TestCachedProperty(unittest.TestCase):
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))
if __name__ == '__main__':