cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Make `mocker.patch.dict` documentation clearer on actual behavior

Open radhikamattoo opened this issue 1 year ago • 0 comments

Documentation

The docs for patch.dict method is:

Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test.

The phrase "to its original state" can be misleading, because this method actually restores a copy of the original data.

I ran into strange behavior with my tests because of my assumption this method would restore the original values, not copies of them.

Let me know if I'm misunderstanding anything :) Thanks all for your hard work!

Linked PRs

  • gh-121755

radhikamattoo avatar Apr 11 '24 17:04 radhikamattoo