gh-151443: Fix documented default of read_data in unittest.mock.mock_open#151444
Conversation
The documented signature showed read_data=None, but the actual default is the empty string -- Lib/unittest/mock.py, the function's docstring, and inspect.signature all agree. The code default changed from None to '' in 2012 (0dccf65); the docs were never updated.
265d073 to
39cebae
Compare
Documentation build overview
|
|
Please sign the CLA. |
|
Done, CLA signed |
|
Just for the future, please do not use the Update Branch button unless necessary (e.g. fixing conflicts, jogging the CI, or very old PRs) as it uses valuable resources. For more information see the devguide. |
|
Thanks @iamsharduld for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-151450 is a backport of this pull request to the 3.15 branch. |
|
GH-151451 is a backport of this pull request to the 3.14 branch. |
|
GH-151452 is a backport of this pull request to the 3.13 branch. |
I see, thanks for the heads up and quick merge! |
|
Thanks for the PR! |
The documented signature of
unittest.mock.mock_openshowsread_data=None, but the real default is the empty string'':Lib/unittest/mock.py:def mock_open(mock=None, read_data=''):inspect.signature(mock_open)->(mock=None, read_data='')The default was changed from
Noneto''in 2012 (0dccf657b51); the documentation was never updated. This corrects the signature in the docs.Documentation-only change, so no
Misc/NEWS.dentry is included.unittest.mock.mock_opendocuments the wrong default forread_data#151443