[issue24653] Mock.assert_has_calls([]) is surprising for users

Karthikeyan Singaravelan report at bugs.python.org
Tue May 21 15:05:34 EDT 2019


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

> Are the correct methods advertised in the right place?  (I don’t use mock so I forgot if there is a method to assert not called or if it’s assertEqual(mock calls count, 0) or some False property)

There is assert_not_called https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.assert_not_called

>>> from unittest.mock import Mock
>>> m = Mock()
>>> m.assert_not_called()

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue24653>
_______________________________________


More information about the Python-bugs-list mailing list