示例#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)