]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-118121: Fix `test_doctest.test_look_in_unwrapped` (#118122)
authorNikita Sobolev <mail@sobolevn.me>
Sun, 21 Apr 2024 07:08:32 +0000 (10:08 +0300)
committerGitHub <noreply@github.com>
Sun, 21 Apr 2024 07:08:32 +0000 (10:08 +0300)
Lib/test/test_doctest/test_doctest.py

index f71d62cc174d6b9a795262310c82df95b2128c61..cba4b16d544a2041e944cbaa52c5368c27e9e87b 100644 (file)
@@ -2545,7 +2545,7 @@ class Wrapper:
         self.func(*args, **kwargs)
 
 @Wrapper
-def test_look_in_unwrapped():
+def wrapped():
     """
     Docstrings in wrapped functions must be detected as well.
 
@@ -2553,6 +2553,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
+    """
+
 @doctest_skip_if(support.check_impl_detail(cpython=False))
 def test_wrapped_c_func():
     """