From ac613d0f8289663895aa56731f46b84b204b2d26 Mon Sep 17 00:00:00 2001 From: Patricio Paez Date: Sun, 4 May 2025 17:27:35 -0600 Subject: [PATCH 1/2] Change the request.Request example method has_data is used in the explanation of mock autospeccing. This method of request.Request was removed in version 3.4. --- Doc/library/unittest.mock.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index 27c169dde72780..091562cc9aef98 100644 --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -2654,9 +2654,9 @@ with any methods on the mock: .. code-block:: pycon - >>> mock.has_data() + >>> mock.header_items() - >>> mock.has_data.assret_called_with() # Intentional typo! + >>> mock.header_items.assret_called_with() # Intentional typo! Auto-speccing solves this problem. You can either pass ``autospec=True`` to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` function to create a From 28288585ab48273c5385d672aabcebaad4e23b25 Mon Sep 17 00:00:00 2001 From: Patricio Paez Date: Mon, 12 May 2025 10:59:42 -0600 Subject: [PATCH 2/2] Replace req.has_data with req.data has_data was removed in version 3.4 --- Doc/library/urllib.request.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index b7c0c7d5099806..db7b2737436500 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1115,7 +1115,7 @@ HTTPHandler Objects .. method:: HTTPHandler.http_open(req) Send an HTTP request, which can be either GET or POST, depending on - ``req.has_data()``. + ``req.data``. .. _https-handler-objects: @@ -1127,7 +1127,7 @@ HTTPSHandler Objects .. method:: HTTPSHandler.https_open(req) Send an HTTPS request, which can be either GET or POST, depending on - ``req.has_data()``. + ``req.data``. .. _file-handler-objects: