-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Here's a test that ensures that Wrapper on top of it handles __doc__ correcty:
cpython/Lib/test/test_doctest/test_doctest.py
Lines 2539 to 2554 in d8f3503
| class Wrapper: | |
| def __init__(self, func): | |
| self.func = func | |
| functools.update_wrapper(self, func) | |
| def __call__(self, *args, **kwargs): | |
| self.func(*args, **kwargs) | |
| @Wrapper | |
| def test_look_in_unwrapped(): | |
| """ | |
| Docstrings in wrapped functions must be detected as well. | |
| >>> 'one other test' | |
| 'one other test' | |
| """ |
The problem is that it does not check that tests are actually executed.
If you remove this doctest from it, this will be the result:
» ./python.exe -m test test_doctest
Using random seed: 2548604185
0:00:00 load avg: 1.71 Run 1 test sequentially
0:00:00 load avg: 1.71 [1/1] test_doctest
== Tests result: SUCCESS ==
1 test OK.
Total duration: 955 ms
Total tests: run=67
Total test files: run=1/1
Result: SUCCESS
So, it does not test anything. And it will continue to pass if Wrapper won't handle __doc__ correctly at some point.
I have a PR ready.
Linked PRs
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error