Пример #1
0
def run_arguments(GG_ARGUMENTS, preference=None):
    """ Run different algorithms with input arguments """
    STUDENT_IDENTIFIERS = remove_absent_students.remove_missing_students(
        GG_ARGUMENTS.absentees,
        read_student_file.read_csv_data(GG_ARGUMENTS.file))
    logging.info("GatorGrouper will group these students:")
    logging.info("\n %s",
                 display.create_escaped_string_from_list(STUDENT_IDENTIFIERS))

    # shuffle the student identifiers
    SHUFFLED_STUDENT_IDENTIFIERS = group_creation.shuffle_students(
        STUDENT_IDENTIFIERS)
    logging.info("GatorGrouper randomly ordered the students:")
    logging.info(
        "\n %s",
        display.create_escaped_string_from_list(SHUFFLED_STUDENT_IDENTIFIERS))

    GROUPED_STUDENTS = input_interface(
        students=SHUFFLED_STUDENT_IDENTIFIERS,
        method=GG_ARGUMENTS.method,
        num_group=GG_ARGUMENTS.num_group,
        preferences=preference,
        preferences_weight=GG_ARGUMENTS.preferences_weight,
        preferences_weight_match=GG_ARGUMENTS.preferences_weight_match,
        objective_weights=GG_ARGUMENTS.objective_weights,
        objective_measures=GG_ARGUMENTS.objective_measures,
    )

    return GROUPED_STUDENTS
Пример #2
0
def test_remove_missing_students_two():
    """Checking to see if absent two students is removed"""
    absent_list = ["Nick", "Marvin"]
    list_of_student_of_lists = [
        ["Nick", False, True, False],
        ["Marvin", False, True, True],
        ["Evin", True, True, False],
    ]
    removed_list = remove_absent_students.remove_missing_students(
        absent_list, list_of_student_of_lists
    )
    assert (absent_list in removed_list) is False
    assert len(removed_list) == 1
Пример #3
0
def test_remove_missing_students():
    """Testing the remove_missing_students() function with
        an input that includes one absent student"""
    list_of_students = [
        ["student1", 0, 1, 0],
        ["student2", 1, 0, 1],
        ["student3", 1, 1, 0],
    ]
    list_of_absent_students = ["student2"]
    desired_output = [["student1", 0, 1, 0], ["student3", 1, 1, 0]]
    actual_output = remove_absent_students.remove_missing_students(
        list_of_absent_students, list_of_students
    )
    assert len(list_of_students) == 3
    assert (desired_output == actual_output) is True
Пример #4
0
def test_remove_missing_students_all():
    """Checking to see if absent all students are removed"""
    absent_list = ["Nick", "Marvin", "Evin"]
    list_of_student_of_lists = [
        ["Nick", 0, 1, 0],
        ["Marvin", 0, 1, 1],
        ["Evin", 1, 1, 0],
    ]
    correct = []
    removed_list = remove_absent_students.remove_missing_students(
        absent_list, list_of_student_of_lists
    )
    assert (absent_list in removed_list) is False
    # is the list empty
    assert not removed_list
    assert correct == removed_list
Пример #5
0
    # parse the arguments and display welcome message
    GG_ARGUMENTS = parse_arguments.parse_arguments(sys.argv[1:])
    display.display_welcome_message()
    logging.info("Configuration of GatorGrouper:")
    logging.debug(GG_ARGUMENTS)

    # read in the student identifiers from the specified file
    input_list = read_student_file.read_csv_data(GG_ARGUMENTS.file)
    check_if_arguments_valid = parse_arguments.check_valid(
        GG_ARGUMENTS, input_list)
    if check_if_arguments_valid is False:
        print("Incorrect command-line arguments.")
        sys.exit(1)
    else:
        STUDENT_IDENTIFIERS = remove_absent_students.remove_missing_students(
            GG_ARGUMENTS.absentees,
            read_student_file.read_csv_data(GG_ARGUMENTS.file))
        logging.info("GatorGrouper will group these students:")
        logging.info(
            "\n %s",
            display.create_escaped_string_from_list(STUDENT_IDENTIFIERS))

        # shuffle the student identifiers
        SHUFFLED_STUDENT_IDENTIFIERS = group_random.shuffle_students(
            STUDENT_IDENTIFIERS)
        logging.info("GatorGrouper randomly ordered the students:")
        logging.info(
            "\n %s",
            display.create_escaped_string_from_list(
                SHUFFLED_STUDENT_IDENTIFIERS),
        )