For anyone, still looking for a slim, elegant solution to this question in 2025. There is a method call_count
in unittest.mock
. So you can do a simple assert :
assert mock_function.call_count == 0
or
TestCase.assertEqual(mock_function.call_count, 0)