Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-101100: Fix Sphinx warnings inlibrary/unittest.mock.rst
#124106
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Doc/library/unittest.mock.rst Outdated
Normally the :attr:`__class__` attribute of an object will return its type. | ||
For a mock object with a :attr:`spec`,``__class__`` returns the spec class | ||
Normally the :attr:`!__class__` attribute of an object will return its type. | ||
For a mock object with a :attr:`spec`,:attr:`!__class__` returns the spec class |
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.
Thespec
attribute seems to be missing or is it an inherited one? (Maybe we could fix it in this PR directly?). Or is it a Sphinx issue?
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.
I think it (andspec_set
) are just missing documentation underhttps://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock
For example, here'sside_effect
:
https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.side_effect
Would you like to suggest some text?
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.
I never used it so I cannot really suggest a good text. I'll leave that task to unittest experts! but we can do it in another PR otherwise.
Doc/library/unittest.mock.rst Outdated
@@ -2615,7 +2615,7 @@ unit tests. Testing everything in isolation is all fine and dandy, but if you | |||
don't test how your units are "wired together" there is still lots of room | |||
for bugs that tests might have caught. | |||
:mod:`mock` already provides a feature to help with this, called speccing. If you | |||
:mod:`unittest.mock` already provides a feature to help with this, called speccing. If you | |||
use a class or instance as the :attr:`spec` for a mock then you can only access |
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.
There is a warning on "spec" here.
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.
Yep, it's not yet documented, can you suggest some text for it? Also forspec_set
?
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.
Maybe just write:attr:`!spec`
.
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.
Done, and also forspec_set
.
a5716a3
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…ythonGH-124106)(cherry picked from commita5716a3)Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
…ythonGH-124106)(cherry picked from commita5716a3)Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
GH-125190 is a backport of this pull request to the3.13 branch. |
GH-125191 is a backport of this pull request to the3.12 branch. |
Uh oh!
There was an error while loading.Please reload this page.
Fix 26 warnings in
library/unittest.mock.rst
:Before:
After:
📚 Documentation preview 📚:https://cpython-previews--124106.org.readthedocs.build/