From f5896a05edf5df91fb1b55bd481ba5b2a3682f4e Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Lapeyre?= Date: Thu, 29 Aug 2019 08:15:53 +0200 Subject: [PATCH] bpo-35946: Improve assert_called_with documentation (GH-11796) --- Doc/library/unittest.mock.rst | 4 ++-- Lib/unittest/mock.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index 19e9715102..304ba53227 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 5846eeb404..c6771ce529 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -888,7 +888,7 @@ class NonCallableMock(Base): 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.""" -- 2.40.0