diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-03-13 07:10:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 07:10:59 (GMT) |
commit | 96c76047096550f193a83d0870b94d378935783f (patch) | |
tree | f69885e72bea938eaa12d91baa3d036ea585ee52 | |
parent | d0c32ae419316cb0d6f06ec8cb2f6b91a878070f (diff) | |
download | cpython-96c76047096550f193a83d0870b94d378935783f.zip cpython-96c76047096550f193a83d0870b94d378935783f.tar.gz cpython-96c76047096550f193a83d0870b94d378935783f.tar.bz2 |
[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 27df81d5643f32be6ae84a00c5cf84b58e849b21)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
-rw-r--r-- | Lib/test/test_functools.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 80d0176..b73e487 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -2618,7 +2618,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') @@ -2707,7 +2710,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( @@ -3035,7 +3041,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_subclass_with___set__(self): """Caching still works for a subclass defining __set__.""" |