Created
May 14, 2017 09:36
-
-
Save Kalimaha/096414abb1ea7ef38af2fe0695e58dd3 to your computer and use it in GitHub Desktop.
pytest-mock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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