assert_called_once_with(*args, **kwargs)
Assert that the mock was called exactly once and with the specified arguments.
>>> 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.