-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
bpo-28249: fix lineno location for empty DocTest instances
#30498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Misc/NEWS.d/next/Library/2022-01-09-14-23-00.bpo-28249.4dzB80.rst
Outdated
Show resolved
Hide resolved
|
This PR is stale because it has been open for 30 days with no activity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran 58 tests in 4.543s
OK
Looks ok.
|
I rebased and resolved a conflict with |
…nGH-30498) Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Łukasz Langa <[email protected]> (cherry picked from commit 8db2b3b) Co-authored-by: Nikita Sobolev <[email protected]>
|
Sorry, @sobolevn and @ambv, I could not cleanly backport this to |
|
Sorry @sobolevn and @ambv, I had trouble checking out the |
|
GH-92978 is a backport of this pull request to the 3.11 branch. |
) (GH-92978) (cherry picked from commit 8db2b3b) Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Łukasz Langa <[email protected]> Co-authored-by: Nikita Sobolev <[email protected]>
…pythonGH-30498) Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Łukasz Langa <[email protected]> (cherry picked from commit 8db2b3b) Co-authored-by: Nikita Sobolev <[email protected]>
|
GH-92981 is a backport of this pull request to the 3.10 branch. |
…GH-30498) (#92981) (cherry picked from commit 8db2b3b) Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Łukasz Langa <[email protected]> Co-authored-by: Nikita Sobolev <[email protected]>
This patch fixes
linenoforDocTestinstances for objects that don't have__doc__attribute.In the original issue this was used as an example:
Before this patch,
doctest.DocTestFinder(exclude_empty=False).find(example_module)was showing:Notice that
linenowas5forexampleandexample.a. Which is clearly wrong, becauseexample.bis on the 5th line. But,example.chadlineno=None.DocTestdocs clearly state:So, now
linenois set toNonewhen__doc__cannot be found. Now, the result for ourexamplemodule will be:Now, everything looks correct.
https://bugs.python.org/issue28249
CC @corona10 as my mentor 🙂