Exemple #1
0
 def test_average1(self):
     answer = avg.compute_average([1, 2, 3, 4, 5])
     self.assertEqual(answer, 3.0)
Exemple #2
0
 def test_average2(self):
     answer = avg.compute_average([2, 3, 4, 5, 6])
     self.assertEqual(answer, 4.0)
Exemple #3
0
 def test_empty_input_average(self):
     answer = avg.compute_average([])
     self.assertEqual(answer, 0)
Exemple #4
0
 def test_average3(self):
     answer = avg.compute_average(['w', 3, 4, 5, 6])
     self.assertRaisesRegex(ValueError, 'number')
Exemple #5
0
 def test_float_input_number(self):
     self.assertEqual(avg.compute_average([2.7, 2.8, 4.8, 4.9]), 3)
Exemple #6
0
    def test_average(self):
        answer = avg.compute_average([1, 2, 3, 4, 5])
        self.assertEqual(answer, 3.0)

        answer = avg.compute_average([2, 4])
        self.assertTrue(answer == 3)
Exemple #7
0
 def test_wrong_average(self):
     answer = avg.compute_average([2, 4])
     self.assertFalse(answer == 2)