Skip to content

Instantly share code, notes, and snippets.

@LiamJolly
Created February 5, 2017 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LiamJolly/419a3feec697cac14d8ae60bbe31f117 to your computer and use it in GitHub Desktop.
Save LiamJolly/419a3feec697cac14d8ae60bbe31f117 to your computer and use it in GitHub Desktop.
Unit test for the simple calculator functions.
import unittest
import simple_calc as sc
class SimpleCalcTest(unittest.TestCase):
def test_add(self):
result = sc.add(1, 2)
self.assertEqual(result, 3)
def test_subtract(self):
result = sc.subtract(2, 1)
self.assertEqual(result, 1)
def test_multiply(self):
result = sc.multiply(2, 2)
self.assertEqual(result, 4)
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment