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