[Python-checkins] bpo-35946: Improve assert_called_with documentation (GH-11796)

Miss Islington (bot) webhook-mailer at python.org
Thu Aug 29 02:39:51 EDT 2019


https://github.com/python/cpython/commit/612d3935ec0b2fbe88b3fae8167f0c503c61a9ca
commit: 612d3935ec0b2fbe88b3fae8167f0c503c61a9ca
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-08-28T23:39:47-07:00
summary:

bpo-35946: Improve assert_called_with documentation (GH-11796)

(cherry picked from commit f5896a05edf5df91fb1b55bd481ba5b2a3682f4e)

Co-authored-by: Rémi Lapeyre <remi.lapeyre at henki.fr>

files:
M Doc/library/unittest.mock.rst
M Lib/unittest/mock.py

diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst
index 19e9715102bf..304ba532274d 100644
--- a/Doc/library/unittest.mock.rst
+++ b/Doc/library/unittest.mock.rst
@@ -317,8 +317,8 @@ the *new_callable* argument to :func:`patch`.
 
     .. method:: assert_called_with(*args, **kwargs)
 
-        This method is a convenient way of asserting that calls are made in a
-        particular way:
+        This method is a convenient way of asserting that the last call has been
+        made in a particular way:
 
             >>> mock = Mock()
             >>> mock.method(1, 2, 3, test='wow')
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index b3dc640f8fe5..3faeb4c9af1f 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -854,7 +854,7 @@ def assert_called_once(self):
             raise AssertionError(msg)
 
     def assert_called_with(self, /, *args, **kwargs):
-        """assert that the mock was called with the specified arguments.
+        """assert that the last call was made with the specified arguments.
 
         Raises an AssertionError if the args and keyword args passed in are
         different to the last call to the mock."""



More information about the Python-checkins mailing list