Skip to content

Instantly share code, notes, and snippets.

@HectorTorres
Created January 11, 2023 19:25
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 HectorTorres/12ff67c8de8368a1ebc425ec693428a5 to your computer and use it in GitHub Desktop.
Save HectorTorres/12ff67c8de8368a1ebc425ec693428a5 to your computer and use it in GitHub Desktop.
import unittest
import math
def function_square(a):
return a*a
def function_square_root(a):
return math.sqrt(a)
def function_sum(a,b):
return a+a
class Test_function1(unittest.TestCase):
def test_function_square(self):
self.assertEquals(function_square(3),4)
class Test_function2(unittest.TestCase):
def test_function_square_root(self):
self.assertEquals(function_square_root(16),4)
def test_function_square(self):
self.assertEquals(function_sum(2,2),4)
#run the program
#python -m unittest test_unit_02.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment