示例#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
示例#2
0
def test_no_arg():
    with pytest.raises(SystemExit):
        assert parse_cli_args(["--" + FILE_OPTION])
示例#3
0
def test_action_open_invalid_file():
    with pytest.raises(SystemExit):
        assert parse_cli_args(["--" + FILE_OPTION, INVALID_FILE])
示例#4
0
def test_file_returns_string():
    ret = parse_cli_args(["--" + FILE_OPTION, VALID_FILE])
    assert type(vars(ret)[FILE_OPTION]) is str
示例#5
0
def test_invalid_option():
    with pytest.raises(SystemExit):
        assert parse_cli_args([INVALID_OPTION])
示例#6
0
def test_switch():
    ret = parse_cli_args(["--" + SWITCH])
    assert vars(ret)[SWITCH] is not SWITCH_DEFAULT
示例#7
0
def test_no_args():
    ret = parse_cli_args([])
    assert vars(ret)[SWITCH] is SWITCH_DEFAULT
示例#8
0
def test_help_option():
    with pytest.raises(SystemExit):
        assert parse_cli_args(["--" + HELP_OPTION])