PyDocs

Nav

Development Tools

Mock.assert_any_call

  • Mock.assert_any_call(*args, **kwargs)
Assert the mock has been called with the specified arguments.

The assert passes if the mock has *ever* been called, unlike
`assert_called_with` and `assert_called_once_with` that only pass if
the call is the most recent one.
1 Example
>>> mock = Mock(return_value=None)
>>> mock(1, 2, arg='thing')
>>> mock('some', 'thing', 'else')
>>> mock.assert_any_call(1, 2, arg='thing')
from the Python docs
See Also
No see-alsos for unittest.mock/Mock.assert_any_call
0 Notes
No notes for Mock.assert_any_call