예제 #1
0
 def test_with_multiple_same_nums_floats(self):
     result = avg([5.00, 5.00, 5.00, 2.00, 2.00])
     self.assertIsInstance(result, float)
     self.assertEqual(19 / 5, result)
예제 #2
0
 def test_with_multiple_same_nums(self):
     result = avg([5, 5, 5, 2, 2])
     self.assertIsInstance(result, float)
     self.assertEqual(19 / 5, result)
예제 #3
0
 def test_with_sring_in_list_arg(self):
     with self.assertRaises(TypeError):
         avg([1, 2, 'hello', 4])
예제 #4
0
 def test_with_unordered(self):
     result = avg([4, 5, 1, 3, 2])
     self.assertIsInstance(result, float)
     self.assertEqual(3, result)
예제 #5
0
 def test_with_sring_arg(self):
     with self.assertRaises(TypeError):
         avg('hello')
예제 #6
0
 def test_with_1_num(self):
     result = avg([5])
     self.assertIsInstance(result, float)
     self.assertEqual(result, 5)