assert_called_once_with(*args, **kwargs)
Assert that the mock was called exactly once and with the specified arguments.
1 2 3 4 5 6 7 8 | >>> mock = Mock(return_value=None) >>> mock( 'foo' , bar= 'baz' ) >>> mock.assert_called_once_with( 'foo' , bar= 'baz' ) >>> mock( 'foo' , bar= 'baz' ) >>> mock.assert_called_once_with( 'foo' , bar= 'baz' ) Traceback (most recent call last): ... AssertionError: Expected 'mock' to be called once. Called 2 times. |
Please login to continue.