https://github.com/python/cpython/commit/e620377918c8927d98533bbfcca894c7e5e78158
commit: e620377918c8927d98533bbfcca894c7e5e78158
branch: main
author: Ivy Xu <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-09-05T15:07:19+01:00
summary:

gh-156970: Set `Mock.return_value`'s docstring (#156971)

Co-authored-by: Stan Ulbrych <[email protected]>

files:
A Misc/NEWS.d/next/Library/2026-09-05-15-27-11.gh-issue-156970.DxlgbB.rst
M Lib/unittest/mock.py

diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index d0ca94668e05bc2..1effc70b5323139 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -595,7 +595,7 @@ def __set_return_value(self, value):
 
     __return_value_doc = "The value to be returned when the mock is called."
     return_value = property(__get_return_value, __set_return_value,
-                            __return_value_doc)
+                            doc=__return_value_doc)
 
 
     @property
diff --git 
a/Misc/NEWS.d/next/Library/2026-09-05-15-27-11.gh-issue-156970.DxlgbB.rst 
b/Misc/NEWS.d/next/Library/2026-09-05-15-27-11.gh-issue-156970.DxlgbB.rst
new file mode 100644
index 000000000000000..dd60841efe821c2
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-09-05-15-27-11.gh-issue-156970.DxlgbB.rst
@@ -0,0 +1 @@
+Set the docstring of :attr:`unittest.mock.Mock.return_value`.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to