def test_list_of_four(self): m = median([9, 8, 7, 10]) self.assertEqual(m, 8.5)
def test_list_of_three(self): m = median([7, 9, 8]) self.assertEqual(m, 8)
def test_list_of_one(self): m = median([7]) self.assertEqual(m, 7)
def test_list_of_two(self): m = median([8, 7]) self.assertEqual(m, 7.5)
def test_empty_list(self): m = median([]) self.assertIsNone(m)