From 8c3c04846f59f4ce00dd23675b2b30cfd431812d Mon Sep 17 00:00:00 2001 From: Ivy Xu Date: Sat, 5 Sep 2026 15:28:17 +0800 Subject: [PATCH 1/3] Set the docstring of `Mock.return_value` correctly. --- 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 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..4ea67c4740f10c5 --- /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:`Mock.return_value` correctly. From 031c5428fb88a4280cec39fe844cb3e9b1e3695e Mon Sep 17 00:00:00 2001 From: Ivy Xu Date: Sat, 5 Sep 2026 15:40:46 +0800 Subject: [PATCH 2/3] Fix the news entry --- .../next/Library/2026-09-05-15-27-11.gh-issue-156970.DxlgbB.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 4ea67c4740f10c5..9298dec009b546d 100644 --- 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 @@ -1 +1 @@ -Set the docstring of :attr:`Mock.return_value` correctly. +Set the docstring of :attr:`unittest.mock.Mock.return_value` correctly. From 7cb1787b153a5f3683f04945915d12beee65af6c Mon Sep 17 00:00:00 2001 From: Ivy Xu Date: Sat, 5 Sep 2026 17:40:39 +0800 Subject: [PATCH 3/3] Apply Stan's suggestion Co-authored-by: Stan Ulbrych --- .../next/Library/2026-09-05-15-27-11.gh-issue-156970.DxlgbB.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 9298dec009b546d..dd60841efe821c2 100644 --- 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 @@ -1 +1 @@ -Set the docstring of :attr:`unittest.mock.Mock.return_value` correctly. +Set the docstring of :attr:`unittest.mock.Mock.return_value`.