Ejemplo n.º 1
0
 def test_average_exception(self):
     with self.assertRaises(ValueError):
         average(-90, 80, 78)
     with self.assertRaises(ValueError):
         average(90, -80, 78)
     with self.assertRaises(ValueError):
         average(90, 80, -78)
Ejemplo n.º 2
0
 def test_average_negative_input(self):
     with self.assertRaises(ValueError):
         average(-90, 89, -78)
 def test_average_exception3(self):
     with self.assertRaises(ValueError):
         average(90, 89, -78)
Ejemplo n.º 4
0
    def test_average(self):

        # this supplies mock data to the input() calls in average()
        with mock.patch('builtins.input', side_effect=[85, 90, 95]):
            assert average_scores.average() == 90