1. import unittest
    2.  
    3. class TestStatisticalFunctions(unittest.TestCase):
    4. def test_average(self):
    5. self.assertEqual(average([20, 30, 70]), 40.0)
    6. self.assertEqual(round(average([1, 5, 7]), 1), 4.3)
    7. average([])
    8. with self.assertRaises(TypeError):
    9. average(20, 30, 70)
    10. unittest.main() # Calling from the command line invokes all tests