Skip to content

gh-134918: Fix and improve doctest's documentation - #134919

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:doctest-docs
May 31, 2025
Merged

serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:doctest-docs

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented May 30, 2025 •

Copy link
Copy Markdown
Member

@serhiy-storchaka
serhiy-storchaka requested review from a team and tim-one May 30, 2025 08:35
@serhiy-storchaka serhiy-storchaka added docs Documentation in the Doc dir skip news needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels May 30, 2025
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs May 30, 2025
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

@tim-one, please look at the floating point examples.

Comment thread Doc/library/doctest.rst
the same file as the module, or separated out into a separate test file.

* Define a ``__test__`` dictionary mapping from regression test topics to
* Define a :attr:`~module.__test__` dictionary mapping from regression test topics to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a Sphinx cross-reference? Seems like it shouldn't; I wouldn't think module.__test__ is a valid cross-ref target within the Python docs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, interesting, I see how that's set up now, thanks.

Isn't this an "off-label" (no pun intended) use of attribute, though? I would expect this to be implemented using a label. It seems odd that an attribute would link to something other than the API docs for (in this case) what would be module.__test__.

I see the benefit here, in that it results in __test__ being monospace-formatted. But it seems like a semantic mismatch to me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can say that this attribute may or may not exist, and dunder names are technically reserved for the language so I'm ok with this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I'm good with it.

@serhiy-storchaka serhiy-storchaka May 30, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet one benefit is adding "__test__ (module attribute)" in the index.

@serhiy-storchaka
serhiy-storchaka merged commit 3c66e59 into python:main May 31, 2025
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs May 31, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 31, 2025
…4919)

(cherry picked from commit 3c66e59)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 31, 2025
…4919)

(cherry picked from commit 3c66e59)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app

bedevere-app Bot commented May 31, 2025

Copy link
Copy Markdown

GH-134966 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label May 31, 2025
@bedevere-app

bedevere-app Bot commented May 31, 2025

Copy link
Copy Markdown

GH-134967 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label May 31, 2025
@serhiy-storchaka
serhiy-storchaka deleted the doctest-docs branch May 31, 2025 09:04
serhiy-storchaka added a commit that referenced this pull request May 31, 2025
…GH-134966)

(cherry picked from commit 3c66e59)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request May 31, 2025
…GH-134967)

(cherry picked from commit 3c66e59)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants