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