From e3671ead9419c7afab6a4e501ade86bc9bc10950 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sun, 21 Apr 2024 10:41:54 +0300 Subject: [PATCH] [3.12] gh-118121: Fix `test_doctest.test_look_in_unwrapped` (#118122) (#118129) --- Lib/test/test_doctest/test_doctest.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_doctest/test_doctest.py b/Lib/test/test_doctest/test_doctest.py index 2722661a236..069418453f1 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(): """