def test_get_regex_searcher_classes(test_input, expected_type):
    args = get_parsed_args(['regex', 'f_name', test_input[0], test_input[1]])
    regex_search_class = get_regex_search_class(args)
    assert isinstance(regex_search_class, expected_type)
示例#2
0
def test_2_optional_param():
    with pytest.raises(ValueError) as ex_info:
        get_parsed_args(['regex', 'f_name', '-c', 'True', '-u', 'True'])
    assert ex_info.value.args[0] == "Optional parameters are mutually exclusive, more then 1 True value was found"
示例#3
0
def test_single_script_input():
    parsed_args = get_parsed_args(['regex', 'f_name'])
    compare_parsed_args(parsed_args, [False, False, False, 'regex', ['f_name']])
示例#4
0
def test_parse_optional_param(test_input, expected):
    parsed_args = get_parsed_args(['regex', 'f_name', '-c', test_input[0], '-u', test_input[1], '-m', test_input[2]])
    compare_parsed_args(parsed_args, [expected[0], expected[1], expected[2], 'regex', ['f_name']])
示例#5
0
def test_no_input():
    with pytest.raises(SystemExit):
        get_parsed_args([])
示例#6
0
def test_no_file_input():
    parsed_args = get_parsed_args(['regex'])
    compare_parsed_args(parsed_args, [False, False, False, 'regex', '-'])
示例#7
0
def test_invalid_regex_input():
    with pytest.raises(SystemExit) as ex_info:
        get_parsed_args(['[0-9]++', 'f_name'])
    assert ex_info.typename == 'SystemExit'
示例#8
0
def test_multi_scripts_input():
    parsed_args = get_parsed_args(['regex', 'f_name_1', 'f_name_2', 'f_name_3'])
    compare_parsed_args(parsed_args, [False, False, False, 'regex', ['f_name_1', 'f_name_2', 'f_name_3']])