[3.12] gh-118121: Fix test_doctest.test_look_in_unwrapped (#118122) (#118129)

This commit is contained in:
Nikita Sobolev 2024-04-21 10:41:54 +03:00 committed by GitHub
parent 4d85f0ae76
commit e3671ead94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2488,7 +2488,7 @@ class Wrapper:
self.func(*args, **kwargs) self.func(*args, **kwargs)
@Wrapper @Wrapper
def test_look_in_unwrapped(): def wrapped():
""" """
Docstrings in wrapped functions must be detected as well. Docstrings in wrapped functions must be detected as well.
@ -2496,6 +2496,21 @@ def test_look_in_unwrapped():
'one other test' '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): if support.check_impl_detail(cpython=True):
def test_wrapped_c_func(): def test_wrapped_c_func():
""" """