Last active
May 17, 2017 14:51
-
-
Save otherwiseguy/4f1738b8e6fc3a1c6f6f6ff0238a5a8a to your computer and use it in GitHub Desktop.
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
def add(x, y): | |
val = 0 | |
for i in range(x + y): | |
val += 1 | |
return val | |
import mock | |
import unittest | |
from adder import add | |
class TestAdd(unittest.TestCase): | |
def test_add_wrong(self): | |
x, y = 1, 3 | |
with mock.patch.object(add, 'range') as mock_range: | |
add.add(x, y) | |
mock_range.assert_called_once_with(x + y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment