Esempio n. 1
0
def test_valid_size(generate_csv):
    """Check that valid size arguments will not verify correctly"""
    correct_arguments = ["--file", generate_csv, "--group-size", "3"]
    parsed_arguments = parse_arguments.parse_arguments(correct_arguments)
    input_list = read_student_file.read_csv_data(parsed_arguments.file)
    checker = parse_arguments.check_valid(parsed_arguments, input_list)
    assert checker is True
Esempio n. 2
0
def test_file_argument_verifiable(generate_csv):
    """Check that valid file arguments will verify correctly"""
    correct_arguments = ["--file", generate_csv]
    parsed_arguments = parse_arguments.parse_arguments(correct_arguments)
    input_list = read_student_file.read_csv_data(parsed_arguments.file)
    checker = parse_arguments.check_valid(parsed_arguments, input_list)
    assert checker is True
Esempio n. 3
0
def test_file_argument_empty():
    """Check that invalid file arguments will not verify correctly"""
    wrong_arguments = ["--file", ""]
    parsed_arguments = parse_arguments.parse_arguments(wrong_arguments)
    input_list = read_student_file.read_csv_data(parsed_arguments.file)
    checker = parse_arguments.check_valid(parsed_arguments, input_list)
    assert checker is False
Esempio n. 4
0
def test_invalid_input(generate_csv):
    """Check that invalid size and number arguments will not verify correctly"""
    wrong_arguments = ["--file", generate_csv, "--num-group", "7"]
    parsed_arguments = parse_arguments.parse_arguments(wrong_arguments)
    input_list = read_student_file.read_csv_data(parsed_arguments.file)
    checker = parse_arguments.check_valid(parsed_arguments, input_list)
    assert checker is False
Esempio n. 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)
    if GG_ARGUMENTS.preferences is None:
        preference = None
    else:
        # Filter out empty names and students without preferences from the preferences CSV
        preference_list = [[
            entry for entry in row if entry != ""
        ] for row in read_student_file.read_csv_data(GG_ARGUMENTS.preferences)
                           if len(row) > 1]
        # Associate student with set of preferred students
        preference = {row[0]: set(row[1:]) for row in preference_list}
    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:
        GROUPED_STUDENT_IDENTIFIERS = run.run_arguments(
            GG_ARGUMENTS, preference)

        # report generated groups
        display.display_student_groups(GROUPED_STUDENT_IDENTIFIERS)