def test_partition_with_one_element(self): lst_for_partition = [3] Sorting.partition(lst_for_partition, 0, 0) self.assertListEqual([3], lst_for_partition)
def test_merge_sort_with_doubles(self): sorted_list = Sorting.merge_sort([]) self.assertListEqual([], sorted_list)
def test_partition(self): r_seq = list(range(55)) + list(range(56, 100)) random.shuffle(r_seq) r_seq = [55] + r_seq self.assertEquals(55, Sorting.partition(r_seq, 0, len(r_seq)-1))
def test_merge_sort(self): sorted_list = Sorting.merge_sort(self.seq) self.assertListEqual(self.sorted_seq, sorted_list)
def test_merge_sort_with_doubles(self): sorted_list = Sorting.merge_sort(self.seq_with_doubles) self.assertListEqual(self.sorted_seq_with_doubles, sorted_list)
def test_insertion_sort_with_empty_list(self): Sorting.selection_sort(self.empty_list) self.assertListEqual([], self.empty_list)
def test_partition_consistence(self): Sorting.partition(self.seq, 0, len(self.seq) - 1) self.assertListEqual(self.sorted_seq, sorted(self.seq))
def test_quick_sort(self): Sorting.quick_sort(self.seq) self.assertListEqual(self.sorted_seq, self.seq)
def test_partition(self): r_seq = list(range(55)) + list(range(56, 100)) random.shuffle(r_seq) r_seq = [55] + r_seq self.assertEquals(55, Sorting.partition(r_seq, 0, len(r_seq) - 1))
def test_partition_consistence(self): Sorting.partition(self.seq, 0, len(self.seq)-1) self.assertListEqual(self.sorted_seq, sorted(self.seq))
def test_insertion_sort(self): Sorting.insertion_sort(self.seq) self.assertListEqual(self.sorted_seq, self.seq)