Ejemplo n.º 1
0
 def test_sum(self):
     self.assertEqual(sum(1, 2), 3)
Ejemplo n.º 2
0
 def test_sum_neg(self):
     self.assertTrue(sum(1, -11) < 0)
Ejemplo n.º 3
0
 def test_sum_type(self):
     with self.assertRaises(TypeError):
         sum("a", 0)
Ejemplo n.º 4
0
def test_sum_invalid_arguments(x, y):
    with pytest.raises(ValueError):
        assert sum(x, y)
Ejemplo n.º 5
0
 def test_sum_pos(self):
     self.assertTrue(sum(1, 1) >= 0)
Ejemplo n.º 6
0
def test_sum_success(x, y, result):
    assert sum(x, y) == result
Ejemplo n.º 7
0
 def test_validate_type(self):
     with self.assertRaises(TypeError):
         sum("pandas", 3)
     with self.assertRaises(TypeError):
         sum(10, "hippos")
Ejemplo n.º 8
0
 def test_validate_string_parse(self):
     self.assertEqual(sum("1", "3"), 4)
Ejemplo n.º 9
0
 def test_validate_range(self):
     with self.assertRaises(AssertionError):
         sum(1200, 3)
Ejemplo n.º 10
0
def test_sum(a, b, expected):
    assert sum(a, b) == expected