def test_parameter_greater_than_one_hundred(self):
     with pytest.raises(ValueError):
         assert sum_solution.compute(101, 1)
     with pytest.raises(ValueError):
         assert sum_solution.compute(101, 101)
     with pytest.raises(ValueError):
         assert sum_solution.compute(1, 101)
Exemple #2
0
def test_invalid_inputs(invalid_value):
    # tests invalid inputs on both x and y - 1 is valid

    with pytest.raises(ValueError):
        sum_solution.compute(1, invalid_value)
    with pytest.raises(ValueError):
        sum_solution.compute(invalid_value, 1)
 def test_parameter_less_than_zero(self):
     with pytest.raises(ValueError):
         assert sum_solution.compute(-1, 1)
     with pytest.raises(ValueError):
         assert sum_solution.compute(-1, -1)
     with pytest.raises(ValueError):
         assert sum_solution.compute(1, -1)
Exemple #4
0
 def test_edge_one(self):
     assert sum_solution.compute(0,100) == 100
Exemple #5
0
 def test_max(self):
     assert sum_solution.compute(100,100) == 200
Exemple #6
0
 def test_sum_01(self):
     assert sum_solution.compute(0, 1) == 1
Exemple #7
0
 def test_notequal(self):
     self.assertNotEqual(sum_solution.compute(1, 1), 3)
Exemple #8
0
 def test_min(self):
     assert sum_solution.compute(0,0) == 0
Exemple #9
0
 def test_bad_left_high(self):
     with pytest.raises(ValueError):
         sum_solution.compute(101,0)
Exemple #10
0
 def test_bad_left_str(self):
     with pytest.raises(Exception):
         sum_solution.compute('a',0)
 def test_sum_100100(self):
     assert sum_solution.compute(100, 100) == 200
Exemple #12
0
 def test_sum(self):
     self.assertEqual(sum_solution.compute(1, 2), 3)
Exemple #13
0
def test_sum(x, y):
    assert sum_solution.compute(x, y) == x + y
 def test_sum_string_params(self):
     with self.assertRaises(TypeError):
         sum_solution.compute("A", '@')
 def test_sum_above_hundred(self):
     with self.assertRaises(ValueError):
         sum_solution.compute(101, 200)
 def test_sum_below_zero(self):
     with self.assertRaises(ValueError):
         sum_solution.compute(-1, -2)
 def test_sum(self):
     assert sum_solution.compute(1, 2) == 3
     assert sum_solution.compute(0, 0) == 0
     assert sum_solution.compute(0, 100) == 100
     assert sum_solution.compute(100, 100) == 200
Exemple #18
0
 def test_edge_two(self):
     assert sum_solution.compute(100,0) == 100
Exemple #19
0
 def test_middle(self):
     assert sum_solution.compute(49,52) == 101
 def test_out_of_bounds_s1(self):
     """ first smaller than bounds """
     with self.assertRaises(ValueError):
         sum_solution.compute(-1, 2)
Exemple #21
0
 def test_bad_left_low(self):
     with pytest.raises(ValueError):
         sum_solution.compute(-1,0)
 def test_out_of_bounds_s2(self):
     """ second smaller than bounds """
     with self.assertRaises(ValueError):
         sum_solution.compute(2, -1)
Exemple #23
0
 def test_bad_left_float(self):
     with pytest.raises(ValueError):
         sum_solution.compute(1.2,0)
 def test_sum(self):
     assert sum_solution.compute(1, 2) == 3
     assert sum_solution.compute(100, 200) != 500
 def test_out_of_bounds_b1(self):
     """ first bigger than bounds """
     with self.assertRaises(ValueError):
         sum_solution.compute(101, 1)
 def test_sum_parameter_out_of_bounds(self):
    with pytest.raises(ValueError):
        sum_solution.compute(101, 2)
 def test_sum(self):
     assert sum_solution.compute("101", 2)
 def test_out_of_bounds_b2(self):
     """ second bigger than bounds """
     with self.assertRaises(ValueError):
         sum_solution.compute(1, 101)
Exemple #29
0
 def test_sum(self):
     assert sum_solution.compute(1, 2) == 3
 def test_sum(self):
     """ vanilla case """
     self.assertEqual(sum_solution.compute(1, 2), 3)