Exemple #1
0
def test_multi_file_returns_list_of_strings():
    ret = parse_cli_args([
        "--" + MULTI_FILE_OPTION, VALID_FILE, "--" + MULTI_FILE_OPTION,
        VALID_FILE
    ])
    assert type(vars(ret)[MULTI_FILE_OPTION]) is list
    for arg in vars(ret)[MULTI_FILE_OPTION]:
        assert type(arg) is str
Exemple #2
0
def test_no_arg():
    with pytest.raises(SystemExit):
        assert parse_cli_args(["--" + FILE_OPTION])
Exemple #3
0
def test_action_open_invalid_file():
    with pytest.raises(SystemExit):
        assert parse_cli_args(["--" + FILE_OPTION, INVALID_FILE])
Exemple #4
0
def test_file_returns_string():
    ret = parse_cli_args(["--" + FILE_OPTION, VALID_FILE])
    assert type(vars(ret)[FILE_OPTION]) is str
Exemple #5
0
def test_invalid_option():
    with pytest.raises(SystemExit):
        assert parse_cli_args([INVALID_OPTION])
Exemple #6
0
def test_switch():
    ret = parse_cli_args(["--" + SWITCH])
    assert vars(ret)[SWITCH] is not SWITCH_DEFAULT
Exemple #7
0
def test_no_args():
    ret = parse_cli_args([])
    assert vars(ret)[SWITCH] is SWITCH_DEFAULT
Exemple #8
0
def test_help_option():
    with pytest.raises(SystemExit):
        assert parse_cli_args(["--" + HELP_OPTION])