Ejemplo n.º 1
0
 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)
Ejemplo n.º 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 def test_edge_one(self):
     assert sum_solution.compute(0,100) == 100
Ejemplo n.º 5
0
 def test_max(self):
     assert sum_solution.compute(100,100) == 200
Ejemplo n.º 6
0
 def test_sum_01(self):
     assert sum_solution.compute(0, 1) == 1
Ejemplo n.º 7
0
 def test_notequal(self):
     self.assertNotEqual(sum_solution.compute(1, 1), 3)
Ejemplo n.º 8
0
 def test_min(self):
     assert sum_solution.compute(0,0) == 0
Ejemplo n.º 9
0
 def test_bad_left_high(self):
     with pytest.raises(ValueError):
         sum_solution.compute(101,0)
Ejemplo n.º 10
0
 def test_bad_left_str(self):
     with pytest.raises(Exception):
         sum_solution.compute('a',0)
Ejemplo n.º 11
0
 def test_sum_100100(self):
     assert sum_solution.compute(100, 100) == 200
Ejemplo n.º 12
0
 def test_sum(self):
     self.assertEqual(sum_solution.compute(1, 2), 3)
Ejemplo n.º 13
0
def test_sum(x, y):
    assert sum_solution.compute(x, y) == x + y
Ejemplo n.º 14
0
 def test_sum_string_params(self):
     with self.assertRaises(TypeError):
         sum_solution.compute("A", '@')
Ejemplo n.º 15
0
 def test_sum_above_hundred(self):
     with self.assertRaises(ValueError):
         sum_solution.compute(101, 200)
Ejemplo n.º 16
0
 def test_sum_below_zero(self):
     with self.assertRaises(ValueError):
         sum_solution.compute(-1, -2)
Ejemplo n.º 17
0
 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
Ejemplo n.º 18
0
 def test_edge_two(self):
     assert sum_solution.compute(100,0) == 100
Ejemplo n.º 19
0
 def test_middle(self):
     assert sum_solution.compute(49,52) == 101
Ejemplo n.º 20
0
 def test_out_of_bounds_s1(self):
     """ first smaller than bounds """
     with self.assertRaises(ValueError):
         sum_solution.compute(-1, 2)
Ejemplo n.º 21
0
 def test_bad_left_low(self):
     with pytest.raises(ValueError):
         sum_solution.compute(-1,0)
Ejemplo n.º 22
0
 def test_out_of_bounds_s2(self):
     """ second smaller than bounds """
     with self.assertRaises(ValueError):
         sum_solution.compute(2, -1)
Ejemplo n.º 23
0
 def test_bad_left_float(self):
     with pytest.raises(ValueError):
         sum_solution.compute(1.2,0)
Ejemplo n.º 24
0
 def test_sum(self):
     assert sum_solution.compute(1, 2) == 3
     assert sum_solution.compute(100, 200) != 500
Ejemplo n.º 25
0
 def test_out_of_bounds_b1(self):
     """ first bigger than bounds """
     with self.assertRaises(ValueError):
         sum_solution.compute(101, 1)
Ejemplo n.º 26
0
 def test_sum_parameter_out_of_bounds(self):
    with pytest.raises(ValueError):
        sum_solution.compute(101, 2)
Ejemplo n.º 27
0
 def test_sum(self):
     assert sum_solution.compute("101", 2)
Ejemplo n.º 28
0
 def test_out_of_bounds_b2(self):
     """ second bigger than bounds """
     with self.assertRaises(ValueError):
         sum_solution.compute(1, 101)
Ejemplo n.º 29
0
 def test_sum(self):
     assert sum_solution.compute(1, 2) == 3
Ejemplo n.º 30
0
 def test_sum(self):
     """ vanilla case """
     self.assertEqual(sum_solution.compute(1, 2), 3)