From: Nikita Sobolev Date: Sun, 21 Apr 2024 07:41:54 +0000 (+0300) Subject: [3.12] gh-118121: Fix `test_doctest.test_look_in_unwrapped` (#118122) (#118129) X-Git-Tag: v3.12.4~190 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e3671ead9419c7afab6a4e501ade86bc9bc10950;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-118121: Fix `test_doctest.test_look_in_unwrapped` (#118122) (#118129) --- diff --git a/Lib/test/test_doctest/test_doctest.py b/Lib/test/test_doctest/test_doctest.py index 2722661a2363..069418453f1f 100644 --- a/Lib/test/test_doctest/test_doctest.py +++ b/Lib/test/test_doctest/test_doctest.py @@ -2488,7 +2488,7 @@ class Wrapper: self.func(*args, **kwargs) @Wrapper -def test_look_in_unwrapped(): +def wrapped(): """ Docstrings in wrapped functions must be detected as well. @@ -2496,6 +2496,21 @@ def test_look_in_unwrapped(): 'one other test' """ +def test_look_in_unwrapped(): + """ + Ensure that wrapped doctests work correctly. + + >>> import doctest + >>> doctest.run_docstring_examples( + ... wrapped, {}, name=wrapped.__name__, verbose=True) + Finding tests in wrapped + Trying: + 'one other test' + Expecting: + 'one other test' + ok + """ + if support.check_impl_detail(cpython=True): def test_wrapped_c_func(): """