def test_partition_when_less_than_3_numbers_passed(self): #the number is never going to be <3 becouse of other the exeptions in method that calls _partitioning numbers = [1, 2] with self.assertRaises(Exception) as cm: _partition(numbers) self.assertEqual("Not enought elements to run partition", str(cm.exception))
def test_partition_splits_list_of_sequential_numbers(self): numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] break_point = _partition(numbers) self.assertEqual(break_point, 5)
def test_partition_numbers_grouped_around_two_medians_one_group_larger_than_the_other( self): numbers = [1, 2, 10, 12, 13, 14, 15, 17] break_point = _partition(numbers) self.assertEqual(break_point, 2)
def test_partition_numbers_grouped_around_two_medians_equal_number_of_elements_in_two_groups( self): numbers = [1, 2, 3, 4, 5, 10, 12, 13, 14, 15] break_point = _partition(numbers) self.assertEqual(break_point, 5)