-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Added reference for return_value in unittest.mock documentation #119207
Conversation
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.
Small change to improve consistency, Nice.
Doc/library/unittest.mock.rst
Outdated
@@ -420,7 +420,7 @@ the *new_callable* argument to :func:`patch`. | |||
parameter as ``True``. Child mocks and the return value mock | |||
(if any) are reset as well. | |||
|
|||
.. note:: *return_value*, and :attr:`side_effect` are keyword-only | |||
.. note:: :attr:`return_value`, and :attr:`side_effect` are keyword-only |
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.
Nice! Attention to detail, increases consistency.
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.
@encukou , LMK if I need to look for anything else.
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.
Both of these refer to the function arguments, so they should be marked up as such (*return_value*
and *side_effect*
).
But, a bit above in:
In case you want to reset *return_value* or :attr:`side_effect`
these refer to attributes of the Mock objects, and should use :attr:
(return_value
should be changed to use :attr:
).
Also added :attr: for return_value above |
Thank you! |
GH-119249 is a backport of this pull request to the 3.12 branch. |
GH-119250 is a backport of this pull request to the 3.13 branch. |
Added reference for
return_value
in documentation📚 Documentation preview 📚: https://cpython-previews--119207.org.readthedocs.build/