Skip to content

Instantly share code, notes, and snippets.

@OrangeTux
Created July 25, 2014 12:40
Show Gist options
  • Save OrangeTux/f8c41a12f07b1c04afc7 to your computer and use it in GitHub Desktop.
Save OrangeTux/f8c41a12f07b1c04afc7 to your computer and use it in GitHub Desktop.
Some pseude test code.
# my_app.py
from math import power
def some_fun(i):
if power(i) > 10:
return True
return False
# test_my_app.py
from my_app import some_func
from math import power
def mock_power(i):
# Real implemention of power is very, very complex.
# But I don't care how it works. When I insert some
# value in my test I expect that it returns 5. And I
# want to test how my software handles this response.
return 5
power = mock_power
test_my_func():
assert test_my_func(5) is False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment