예제 #1
0
 def test_sum(self):
     self.assertEqual(sum_solution.compute(1, 2), 3)
     self.assertEqual(sum_solution.compute(1.03, 2.089),
                      'inputs must be integers in the range 1-100')
     self.assertEqual(sum_solution.compute(513, 209),
                      'inputs must be integers in the range 1-100')
     self.assertEqual(sum_solution.compute(-3, -5),
                      'inputs must be integers in the range 1-100')
예제 #2
0
 def test_sum(self):
     self.assertEqual(sum_solution.compute(1, 2), 3)
예제 #3
0
def test_sum_positive_cases(x, y, expected):
    assert sum_solution.compute(x, y) == expected
예제 #4
0
def test_sum_negative_cases(x, y):
    with raises(Exception):
        sum_solution.compute(x, y)
예제 #5
0
 def test_sum_raise_error_when_negative_numbers(self):
     # test sun function raise error when the number is not integer positive
     with pytest.raises(ValueError):
         sum_solution.compute(-1, 7)
예제 #6
0
 def test_sum(self):
     # test sum function return expected putput
     assert sum_solution.compute(1, 2) == 3
예제 #7
0
 def test_sum_number_higher_than_100(self):
     # test function raises error when number higher than 100
     with pytest.raises(ValueError):
         sum_solution.compute(200, 5)
예제 #8
0
 def test_sum_raise_erro_when_adds_floats(self):
     # test sun function raise error when the numbers are floats
     with pytest.raises(ValueError):
         sum_solution.compute(1.5, 5.9)
예제 #9
0
def test_sum():
    assert 3 == sum_solution.compute(1, 2)
예제 #10
0
 def test_sum(self):
     assert sum_solution.compute(1, 2) == 3
     assert sum_solution.compute(2, 2) == 4
     assert sum_solution.compute(3, 2) == 5
예제 #11
0
 def test_sum_string(self):
     with self.assertRaises(TypeError):
         sum_solution.compute(1,'2')
예제 #12
0
 def test_sum_float(self):
     with self.assertRaises(TypeError):
         sum_solution.compute(1,1.1)