Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.