Skip to content

Instantly share code, notes, and snippets.

@podhmo
Created June 20, 2014 19:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save podhmo/58393a4d17e14dcd2b69 to your computer and use it in GitHub Desktop.
Save podhmo/58393a4d17e14dcd2b69 to your computer and use it in GitHub Desktop.
# -*- 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
# -*- coding:utf-8 -*-
def add(x, y):
return [x, y]
# -*- 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