Skip to content
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

Merged
merged 2 commits into from
May 20, 2024

Conversation

Tialo
Copy link
Contributor

@Tialo Tialo commented May 20, 2024

Added reference for return_value in documentation


📚 Documentation preview 📚: https://cpython-previews--119207.org.readthedocs.build/

Copy link

cpython-cla-bot bot commented May 20, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app bedevere-app bot added docs Documentation in the Doc dir skip news awaiting review labels May 20, 2024
Copy link
Contributor

@blaisep blaisep left a 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.

@@ -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
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Member

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:).

@Tialo
Copy link
Contributor Author

Tialo commented May 20, 2024

Also added :attr: for return_value above

@encukou encukou merged commit 6b80a5b into python:main May 20, 2024
26 checks passed
@encukou
Copy link
Member

encukou commented May 20, 2024

Thank you!

@encukou encukou added needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels May 20, 2024
@miss-islington-app
Copy link

Thanks @Tialo for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @Tialo for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 20, 2024
…H-119207)

(cherry picked from commit 6b80a5b)

Co-authored-by: Tialo <65392801+Tialo@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 20, 2024
…H-119207)

(cherry picked from commit 6b80a5b)

Co-authored-by: Tialo <65392801+Tialo@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented May 20, 2024

GH-119249 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label May 20, 2024
@bedevere-app
Copy link

bedevere-app bot commented May 20, 2024

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

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label May 20, 2024
encukou pushed a commit that referenced this pull request May 20, 2024
…H-119207) (GH-119249)

Use correct markup in unittest.mock.reset_mock documentation (GH-119207)
(cherry picked from commit 6b80a5b)

Co-authored-by: Tialo <65392801+Tialo@users.noreply.github.com>
encukou pushed a commit that referenced this pull request May 20, 2024
…H-119207) (GH-119250)

Use correct markup in unittest.mock.reset_mock documentation (GH-119207)
(cherry picked from commit 6b80a5b)

Co-authored-by: Tialo <65392801+Tialo@users.noreply.github.com>
@Tialo Tialo deleted the patch-1 branch May 23, 2024 18:24
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
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 issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants