@@ -275,14 +275,14 @@ the *new_callable* argument to :func:`patch`.
275
275
276
276
.. method :: assert_called_once_with(*args, **kwargs)
277
277
278
- Assert that the mock was called exactly once and with the specified
279
- arguments.
278
+ Assert that the mock was called exactly once and that that call was
279
+ with the specified arguments.
280
280
281
281
>>> mock = Mock(return_value = None )
282
282
>>> mock(' foo' , bar = ' baz' )
283
283
>>> mock.assert_called_once_with(' foo' , bar = ' baz' )
284
- >>> mock(' foo ' , bar = ' baz ' )
285
- >>> mock.assert_called_once_with(' foo ' , bar = ' baz ' )
284
+ >>> mock(' other ' , bar = ' values ' )
285
+ >>> mock.assert_called_once_with(' other ' , bar = ' values ' )
286
286
Traceback (most recent call last):
287
287
...
288
288
AssertionError: Expected 'mock' to be called once. Called 2 times.
@@ -294,7 +294,8 @@ the *new_callable* argument to :func:`patch`.
294
294
295
295
The assert passes if the mock has *ever * been called, unlike
296
296
:meth: `assert_called_with ` and :meth: `assert_called_once_with ` that
297
- only pass if the call is the most recent one.
297
+ only pass if the call is the most recent one, and in the case of
298
+ :meth: `assert_called_once_with ` it must also be the only call.
298
299
299
300
>>> mock = Mock(return_value = None )
300
301
>>> mock(1 , 2 , arg = ' thing' )
0 commit comments