def sort_to_result(all_courses): return { 'name': Course.sort_by_name(all_courses), 'id': Course.sort_by_id(all_courses), 'rating': Course.sort_by_rating(all_courses), 'load': Course.sort_by_load(all_courses), 'num_reviews': Course.sort_by_num_reviews(all_courses), 'num_raters': Course.sort_by_num_raters(all_courses) }
def test_sort_by_num_reviews(all_courses): courses = list(Course.sort_by_num_reviews(all_courses)) for index in range(len(courses) - 1): assert courses[index].num_of_reviewers >= courses[index + 1].num_of_reviewers