Skip to content

Instantly share code, notes, and snippets.

@Kalimaha
Created May 14, 2017 09:36
Show Gist options
  • Select an option

  • Save Kalimaha/096414abb1ea7ef38af2fe0695e58dd3 to your computer and use it in GitHub Desktop.

Select an option

Save Kalimaha/096414abb1ea7ef38af2fe0695e58dd3 to your computer and use it in GitHub Desktop.
pytest-mock
import calculator
def test_answer(mocker):
mocker.patch.object(calculator, 'sum')
calculator.sum.return_value = 123
assert calculator.sum(2, 3) == 123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment