@@ -303,14 +303,14 @@ the *new_callable* argument to :func:`patch`.
303
303
304
304
.. method :: assert_called_once_with(*args, **kwargs)
305
305
306
- Assert that the mock was called exactly once and with the specified
307
- arguments.
306
+ Assert that the mock was called exactly once and that that call was
307
+ with the specified arguments.
308
308
309
309
>>> mock = Mock(return_value = None )
310
310
>>> mock(' foo' , bar = ' baz' )
311
311
>>> mock.assert_called_once_with(' foo' , bar = ' baz' )
312
- >>> mock(' foo ' , bar = ' baz ' )
313
- >>> mock.assert_called_once_with(' foo ' , bar = ' baz ' )
312
+ >>> mock(' other ' , bar = ' values ' )
313
+ >>> mock.assert_called_once_with(' other ' , bar = ' values ' )
314
314
Traceback (most recent call last):
315
315
...
316
316
AssertionError: Expected 'mock' to be called once. Called 2 times.
@@ -322,7 +322,8 @@ the *new_callable* argument to :func:`patch`.
322
322
323
323
The assert passes if the mock has *ever * been called, unlike
324
324
:meth: `assert_called_with ` and :meth: `assert_called_once_with ` that
325
- only pass if the call is the most recent one.
325
+ only pass if the call is the most recent one, and in the case of
326
+ :meth: `assert_called_once_with ` it must also be the only call.
326
327
327
328
>>> mock = Mock(return_value = None )
328
329
>>> mock(1 , 2 , arg = ' thing' )
0 commit comments