summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2024-03-13 06:41:37 (GMT)
committerGitHub <noreply@github.com>2024-03-13 06:41:37 (GMT)
commit27df81d5643f32be6ae84a00c5cf84b58e849b21 (patch)
treea35e68376cfe1de057530a2ad9db74e5ef0387d2 /Lib
parent43986f55671ba2f7b08f8c5cea69aa136a093697 (diff)
downloadcpython-27df81d5643f32be6ae84a00c5cf84b58e849b21.zip
cpython-27df81d5643f32be6ae84a00c5cf84b58e849b21.tar.gz
cpython-27df81d5643f32be6ae84a00c5cf84b58e849b21.tar.bz2
gh-115264: Fix `test_functools` with `-00` mode (#115276)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_functools.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index 4eb3226..1a6d8af 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -2696,7 +2696,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')
@@ -2785,7 +2788,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(
@@ -3128,7 +3134,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))
def test_module(self):
self.assertEqual(CachedCostItem.cost.__module__, CachedCostItem.__module__)