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