def sortActivitiesAlphabetic(list): """ This function return the list sorted alphabetic. :param list: list - unsorted list :return: list - sorted list """ return bingoSort(list, key=lambda x: x.getDescription())
def sortActivitiesByDate(list): """ This function return the list sorted by the date. :param list: list - unsorted list :return: list - sorted list """ return bingoSort(list, key=lambda x: x.getDate())
def test_bingoSort(self): bingoSort([]) l = random.sample(range(1, 100), 50) + random.sample(range(1, 100), 50) + random.sample(range(1, 100), 50) +\ random.sample(range(1, 100), 50) + random.sample(range(1, 100), 50) + random.sample(range(1, 100), 50) self.assertEqual(bingoSort(l), sorted(l)) self.assertEqual(bingoSort(l, reverse=True), sorted(l, reverse=True)) l = random.sample(range(1, 10000), 5000) self.assertEqual(bingoSort(l), sorted(l)) self.assertEqual(bingoSort(l, reverse=True), sorted(l, reverse=True))