Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created March 9, 2019 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/6ccac94e1ff1e7ab85269e62214a32fe to your computer and use it in GitHub Desktop.
Save NMZivkovic/6ccac94e1ff1e7ab85269e62214a32fe to your computer and use it in GitHub Desktop.
def test_verify_called_once(self):
m = mock.Mock()
m.called_function.return_value = 11
m.called_function()
m.called_function.assert_called_once()
def test_verify_called_multiple(self):
m = mock.Mock()
m.called_function.return_value = 11
m.called_function()
m.called_function()
m.called_function()
self.assertEqual(m.called_function.call_count, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment