def test_sort_priority_ten_items_with_same_priority_every_item_has_priority_conflicts_two_with_same_time_added(self): todo_list = [{'task_name': 'lay down', 'completed': False, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 5)}, {'task_name': 'empty dishwasher', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 8)}, {'task_name': 'Clean front door', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 3)}, {'task_name': 'fill dishwasher', 'completed': False, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 6)}, {'task_name': 'Clean backyard', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 7)}, {'task_name': 'rake leaves', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 3)}, {'task_name': 'go for run', 'completed': True, 'priority': 10, 'time_added': time.mktime(time.gmtime()) + 2}, {'task_name': 'cut the lawn', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 1)}] todo.sort_priority(todo_list) self.assertEqual(todo_list, [{'task_name': 'cut the lawn', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 1)}, {'task_name': 'go for run', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 2)}, {'task_name': 'Clean front door', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 3)}, {'task_name': 'rake leaves', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 3)}, {'task_name': 'lay down', 'completed': False, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 5)}, {'task_name': 'fill dishwasher', 'completed': False, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 6)}, {'task_name': 'Clean backyard', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 7)}, {'task_name': 'empty dishwasher', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 8)}])
def test_sort_priority_ten_items_with_three_different_priority_conflicts(self): todo_list = [{'task_name': 'lay down', 'completed': False, 'priority': 10, 'time_added': time.mktime(time.gmtime())}, {'task_name': 'empty dishwasher', 'completed': True, 'priority': 20, 'time_added': time.mktime(time.gmtime())}, {'task_name': 'Clean front door', 'completed': True, 'priority': 8, 'time_added': (time.mktime(time.gmtime()) + 1)}, {'task_name': 'fill dishwasher', 'completed': False, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 1)}, {'task_name': 'Clean backyard', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 2)}, {'task_name': 'rake leaves', 'completed': True, 'priority': 8, 'time_added': time.mktime(time.gmtime())}, {'task_name': 'go for run', 'completed': True, 'priority': 5, 'time_added': time.mktime(time.gmtime()) + 1}, {'task_name': 'cut the lawn', 'completed': True, 'priority': 5, 'time_added': time.mktime(time.gmtime())}] todo.sort_priority(todo_list) self.assertEqual(todo_list, [{'task_name': 'cut the lawn', 'completed': True, 'priority': 5, 'time_added': time.mktime(time.gmtime())}, {'task_name': 'go for run', 'completed': True, 'priority': 5, 'time_added': (time.mktime(time.gmtime()) + 1)}, {'task_name': 'rake leaves', 'completed': True, 'priority': 8, 'time_added': time.mktime(time.gmtime())}, {'task_name': 'Clean front door', 'completed': True, 'priority': 8, 'time_added': (time.mktime(time.gmtime()) + 1)}, {'task_name': 'lay down', 'completed': False, 'priority': 10, 'time_added': time.mktime(time.gmtime())}, {'task_name': 'fill dishwasher', 'completed': False, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 1)}, {'task_name': 'Clean backyard', 'completed': True, 'priority': 10, 'time_added': (time.mktime(time.gmtime()) + 2)}, {'task_name': 'empty dishwasher', 'completed': True, 'priority': 20, 'time_added': time.mktime(time.gmtime())}])