def test_add(self):
        #only the instance of this class can access this
        a_method = Add()
        #wanna check if our add is going to add
        #needs 1st and second parameter and message when test failed
        #a_method inserted so we want to access the add method
        self.assertEqual(2, a_method.add(1, 1), " adding 1 to 1 equal 2")


#in terminal python3 -m unittest test_mini_calculator
예제 #2
0
 def test_add(self):
     a_method = Add()
     self.assertEqual(2, a_method.add(1, 1), "Adding 1 to 1")
 def test_add(self):
     a_method = Add()
     self.assertEqual(2, a_method.add(1, 1))
예제 #4
0
 def test_add(self):
     a_method = Add()
     self.assertEqual(2, a_method.add(1,1) "Adding 1 to 1 should be 2.")
 def text_add(self):
     a_method = Add()
     self.assertEqual(2, a_method.add(1, 1), 'Adding 1 and 1 should be 2')