Created
June 20, 2014 19:19
-
-
Save podhmo/58393a4d17e14dcd2b69 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
# -*- coding:utf-8 -*- | |
import mock | |
from not_change_work import work | |
with mock.patch("not_change_source.add") as m: | |
result = work(1, 2) | |
print(result) | |
print(m.called) | |
# [1, 2] | |
# False | |
with mock.patch("not_change_work.add") as m: | |
result = work(1, 2) | |
print(result) | |
print(m.called) | |
# [1, 2] | |
# False |
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
# -*- coding:utf-8 -*- | |
def add(x, y): | |
return [x, y] |
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
# -*- coding:utf-8 -*- | |
from not_change_source import add | |
def work(x, y, add=add): | |
return add(x, y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment