forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythongh-117294: Report DocTestCase as skipped if all examples in the…
… doctest are skipped (pythonGH-117297)
- Loading branch information
Showing
7 changed files
with
87 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"""This is a sample module used for testing doctest. | ||
This module includes various scenarios involving skips. | ||
""" | ||
|
||
def no_skip_pass(): | ||
""" | ||
>>> 2 + 2 | ||
4 | ||
""" | ||
|
||
def no_skip_fail(): | ||
""" | ||
>>> 2 + 2 | ||
5 | ||
""" | ||
|
||
def single_skip(): | ||
""" | ||
>>> 2 + 2 # doctest: +SKIP | ||
4 | ||
""" | ||
|
||
def double_skip(): | ||
""" | ||
>>> 2 + 2 # doctest: +SKIP | ||
4 | ||
>>> 3 + 3 # doctest: +SKIP | ||
6 | ||
""" | ||
|
||
def partial_skip_pass(): | ||
""" | ||
>>> 2 + 2 # doctest: +SKIP | ||
4 | ||
>>> 3 + 3 | ||
6 | ||
""" | ||
|
||
def partial_skip_fail(): | ||
""" | ||
>>> 2 + 2 # doctest: +SKIP | ||
4 | ||
>>> 2 + 2 | ||
5 | ||
""" | ||
|
||
def no_examples(): | ||
"""A docstring with no examples should not be counted as run or skipped.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This is a sample doctest in a text file, in which all examples are skipped. | ||
|
||
>>> 2 + 2 # doctest: +SKIP | ||
5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Library/2024-03-27-16-43-42.gh-issue-117294.wbXNFv.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
A ``DocTestCase`` now reports as skipped if all examples in the doctest are | ||
skipped. |