def test_with_multiple_same_nums_even(self): result = median([5, 5, 5, 2, 2, 2]) self.assertIsInstance(result, tuple) self.assertEqual((2, 5), result)
def test_with_multiple_same_nums_even_floats(self): result = median([5.00, 5.00, 5.00, 2.00, 2.00, 2.00]) self.assertIsInstance(result, tuple) self.assertEqual((2, 5), result)
def test_with_multiple_same_nums_odd(self): result = median([5, 5, 5, 2, 2]) self.assertEqual(5, result)
def test_with_multiple_same_nums_odd_floats(self): result = median([5.00, 5.00, 5.00, 2.00, 2.00]) self.assertEqual(5, result)
def test_with_odd_set_of_nums_unordered(self): result = median([4, 5, 1, 3, 2]) self.assertEqual(3, result)
def test_with_sring_in_list_arg(self): with self.assertRaises(TypeError): median([1, 2, 'hello', 4])
def test_with_even_set_of_nums_unordered(self): result = median([4, 2, 1, 3]) self.assertIsInstance(result, tuple) self.assertEqual((2, 3), result)
def test_with_odd_set_of_nums(self): result = median([1, 2, 3, 4, 5]) self.assertEqual(3, result)
def test_with_even_set_of_nums(self): result = median([1, 2, 3, 4]) self.assertEqual((2, 3), result)
def test_with_sring_arg(self): with self.assertRaises(TypeError): median('hello')
def test_with_1_num(self): result = median([5]) self.assertEqual(result, 5)