From 36f954f45c89db6898ccb314ba8655ff7b39a45c Mon Sep 17 00:00:00 2001 From: Ivy Xu Date: Sat, 5 Sep 2026 22:07:19 +0800 Subject: [PATCH] gh-156970: Set `Mock.return_value`'s docstring (GH-156971) (cherry picked from commit e620377918c8927d98533bbfcca894c7e5e78158) Co-authored-by: Ivy Xu Co-authored-by: Stan Ulbrych --- Lib/unittest/mock.py | 2 +- .../next/Library/2026-09-05-15-27-11.gh-issue-156970.DxlgbB.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2026-09-05-15-27-11.gh-issue-156970.DxlgbB.rst diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 8cf1e5411e91f71..aad4182f304475c 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -597,7 +597,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`.