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
Example #2
0
def TestAdd():
    assert Add(2, 3) == 5
    assert Add(5, 5) == 10
    print("Add funtion is working correctly")
def TestAdd():
    assert Add(17, 3) == 20
    print("Add Function works correctly!! :)")
Example #4
0
 def test_add(self):
     a_method = Add()
     self.assertEqual(2, a_method.add(1,1) "Adding 1 to 1 should be 2.")
Example #5
0
def TestAdd():
    # Function assert: ensure that it always be true
    assert Add(2, 3) == 5
    print("Add function works correctly")
Example #6
0
 def test_newline_input(self):
     self.assertEqual(Add('1\n,2,3'), 6)
     self.assertEqual(Add('1,\n2,4'), 7)
Example #7
0
 def test_negative_numbers(self):
     with self.assertRaises(TypeError):
         Add('//@\n2@3@-8')
Example #8
0
 def test_add_false(self):
     """
 	Test to check if the add wont' return incorrect value
 	"""
     self.assertNotEqual(100, Add(3, 7))
Example #9
0
def TestAdd():
    assert Add(2, 3) == 5
    assert Add(5, 5) == 10
    print("Add Function works correctly")
Example #10
0
 def test_custom_delimiter(self):
     self.assertEqual(Add('//;\n1;3;4'), 8)
     self.assertEqual(Add('//$\n1$2$3'), 6)
     self.assertEqual(Add('//@\n2@3@8'), 13)
 def test_add(self):
     a_method = Add()
     self.assertEqual(2, a_method.add(1, 1))
 def text_add(self):
     a_method = Add()
     self.assertEqual(2, a_method.add(1, 1), 'Adding 1 and 1 should be 2')
Example #13
0
def TestAdd():
    assert Add(2, 3) == 5
    assert Add(5, 6) == 11
    assert Add(10, 9) == 19
    print("Add function works correctly")
Example #14
0
 def test_add(self):
     a_method = Add()
     self.assertEqual(2, a_method.add(1, 1), "Adding 1 to 1")
Example #15
0
 def test_numbers_lg_1000(self):
     self.assertEqual(Add('2,1001'), 2)
Example #16
0
 def test_add_true(self):
     """
 	Test to check if the add returns correct value
 	"""
     self.assertEqual(10, Add(3, 7))
Example #17
0
 def test_comma_delimiter(self):
     self.assertEqual(Add('1,2,5'), 8)
def TestAdd():
    assert Add(2, 3) == 5
    print("Add function works correctly")
Example #19
0
def TestAdd():
    # assert <condition>,<error message>
    assert Add(2,3) == 5, "sum of 2 and 3 should be 5"
    assert Add(5,5) == 10
    print("Add Function works correctly")