unittest.mock.Mock.assert_not_called()

assert_not_called()

Assert the mock was never called.

>>> m = Mock()
>>> m.hello.assert_not_called()
>>> obj = m.hello()
>>> m.hello.assert_not_called()
Traceback (most recent call last):
  ...
AssertionError: Expected 'hello' to not have been called. Called 1 times.

New in version 3.5.

doc_python
2016-10-07 17:46:08
Comments
Leave a Comment

Please login to continue.