Exemple #1
0
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())
Exemple #2
0
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())
Exemple #3
0
  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))