Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Add my_product function #37

Closed
wants to merge 10 commits into from
6 changes: 6 additions & 0 deletions sprint_tutorial/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ def my_sum(x, y):
""" Compute the sum of 2 numbers
"""
return 2*(x + y)


def my_product(x, y):
""" Compute the product of 2 numbers
"""
return x * y
14 changes: 13 additions & 1 deletion sprint_tutorial/tests/test_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
from nose.tools import assert_equal

from sprint_tutorial.compute import my_sum
from sprint_tutorial.compute import my_product, my_sum


def test_my_sum1():
Expand All @@ -11,3 +11,15 @@ def test_my_sum1():

def test_my_sum2():
assert_equal(my_sum(1, -1), 0)


def test_my_product1():
""" Test simple product
"""
assert_equal(my_product(1, 1), 1)


def test_my_product2():
""" Test slightly more complex product
"""
assert_equal(my_product(2, 3), 6)