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

gh-117765: Improve documentation for mocker.patch.dict #121755

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Doc/library/unittest.mock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,8 @@ patch.dict
.. function:: patch.dict(in_dict, values=(), clear=False, **kwargs)

Patch a dictionary, or dictionary like object, and restore the dictionary
to its original state after the test.
to its original state after the test, where the restored dictionary is a
copy of the dictionary as it was before the test.

*in_dict* can be a dictionary or a mapping like container. If it is a
mapping then it must at least support getting, setting and deleting items
Expand Down
3 changes: 2 additions & 1 deletion Lib/unittest/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,8 @@ def patch(
class _patch_dict(object):
"""
Patch a dictionary, or dictionary like object, and restore the dictionary
to its original state after the test.
to its original state after the test, where the restored dictionary is
a copy of the dictionary as it was before the test.

`in_dict` can be a dictionary or a mapping like container. If it is a
mapping then it must at least support getting, setting and deleting items
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved documentation for :func:`unittest.mock.patch.dict`
Loading