Skip to content

Commit d89c54d

Browse files
GovernmentPlatesestyxx
authored andcommitted
pythongh-117765: Improve documentation for mocker.patch.dict (python#121755)
1 parent 94a425c commit d89c54d

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Doc/library/unittest.mock.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,8 @@ patch.dict
16241624
.. function:: patch.dict(in_dict, values=(), clear=False, **kwargs)
16251625

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

16291630
*in_dict* can be a dictionary or a mapping like container. If it is a
16301631
mapping then it must at least support getting, setting and deleting items

Lib/unittest/mock.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,8 @@ def patch(
18291829
class _patch_dict(object):
18301830
"""
18311831
Patch a dictionary, or dictionary like object, and restore the dictionary
1832-
to its original state after the test.
1832+
to its original state after the test, where the restored dictionary is
1833+
a copy of the dictionary as it was before the test.
18331834
18341835
`in_dict` can be a dictionary or a mapping like container. If it is a
18351836
mapping then it must at least support getting, setting and deleting items
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improved documentation for :func:`unittest.mock.patch.dict`

0 commit comments

Comments
 (0)