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)
def test_with_multiple_same_nums(self): result = avg([5, 5, 5, 2, 2]) self.assertIsInstance(result, float) self.assertEqual(19 / 5, result)
def test_with_sring_in_list_arg(self): with self.assertRaises(TypeError): avg([1, 2, 'hello', 4])
def test_with_unordered(self): result = avg([4, 5, 1, 3, 2]) self.assertIsInstance(result, float) self.assertEqual(3, result)
def test_with_sring_arg(self): with self.assertRaises(TypeError): avg('hello')
def test_with_1_num(self): result = avg([5]) self.assertIsInstance(result, float) self.assertEqual(result, 5)