Exemplo n.º 1
0
def test_match_command_trailing_files_star_allowed_none_provided():
    _cmdline_match_command(State(), ['a', 'b', '*'], ['a', '-b'])
Exemplo n.º 2
0
def test_constraint_regexp_match():
    _cmdline_match_command(ps(), ['a', 'n:', None, {'-n' : re.compile(r'^aaa$')}], ['a', '-n', 'aaa'])
Exemplo n.º 3
0
def test_constraint_callable_match():
    _cmdline_match_command(ps(), ['a', 'n:', None, {'-n' : lambda x: len(x) == 1}], ['a', '-n', 'X'])
Exemplo n.º 4
0
def test_match_command_filename_set_match_wrong_order():
    _cmdline_match_command(ps(), ['a', '', {'first.txt', 'second.txt'}], ['a', 'second.txt', 'first.txt'])
Exemplo n.º 5
0
def test_constraint_text_match():
    _cmdline_match_command(ps(), ['a', 'n:', None, {'-n' : '3'}], ['a', '-n', '3'])
Exemplo n.º 6
0
def test_match_command_filename_list_too_long():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a', '', ['first.txt', 'second.txt']], ['a', 'first.txt'])
Exemplo n.º 7
0
def test_match_command_filename_re_match_pattern():
    _cmdline_match_command(ps(), ['a', '', [re.compile(r'.+\.txt')]], ['a', 'first.txt'])
Exemplo n.º 8
0
def test_match_command_commands_mismatch():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a'], ['b'])
Exemplo n.º 9
0
def test_match_command_unexpected_actual_parameters():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a'], ['b', 'c'])
Exemplo n.º 10
0
def test_match_command_actual_is_nonempty():
    with pytest.raises(AssertionError):
        _cmdline_match_command(ps(), ['a'], [])
Exemplo n.º 11
0
def test_match_command_commands_match():
    _cmdline_match_command(ps(), ['a'], ['a'])
Exemplo n.º 12
0
def test_constraint_text_mismatch():
    with pytest.raises(Exception):
        _cmdline_match_command(State(), ['a', 'n:', None, {'-n' : '3'}], ['a', '-n', 'X'])
Exemplo n.º 13
0
def test_match_command_filename_set_too_long():
    with pytest.raises(Exception):
        _cmdline_match_command(State(), ['a', '', {'first.txt', 'second.txt'}], ['a', 'first.txt'])
Exemplo n.º 14
0
def test_match_command_filename_list_wrong_names():
    with pytest.raises(Exception):
        _cmdline_match_command(State(), ['a', '', ['first.txt', 'second.txt']], ['a', 'first.txt', 'third.txt'])
Exemplo n.º 15
0
def test_match_command_trailing_files_plus_allowed_none_provided():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a', 'b', '+'], ['a', '-b'])
Exemplo n.º 16
0
def test_match_command_no_flags_and_non_provided():
    _cmdline_match_command(ps(), ['a', ''], ['a'])
Exemplo n.º 17
0
def test_match_command_filename_list_match():
    _cmdline_match_command(ps(), ['a', '', ['first.txt', 'second.txt']], ['a', 'first.txt', 'second.txt'])
Exemplo n.º 18
0
def test_match_command_no_flags_and_some_provided():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a', ''], ['a', '-b'])
Exemplo n.º 19
0
def test_match_command_filename_re_match_simple():
    _cmdline_match_command(ps(), ['a', '', [re.compile(r'first\.txt')]], ['a', 'first.txt'])
Exemplo n.º 20
0
def test_match_command_no_flags_and_filenames_provided():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a', ''], ['a', 'filename'])
Exemplo n.º 21
0
def test_match_command_filename_re_match_trailing():
    _cmdline_match_command(ps(), ['cp', '', ['first.txt', re.compile(r'dir/?')]], ['cp', 'first.txt', 'dir/'])
Exemplo n.º 22
0
def test_match_command_single_flag_no_argument_match():
    _cmdline_match_command(ps(), ['a', 'b'], ['a', '-b'])
Exemplo n.º 23
0
def test_match_command_filename_set_wrong_names():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a', '', {'first.txt', 'second.txt'}], ['a', 'first.txt', 'third.txt'])
Exemplo n.º 24
0
def test_match_command_single_flag_no_argument_mismatch():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a', 'b'], ['a', '-X'])
Exemplo n.º 25
0
def test_constraint_text_mismatch():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a', 'n:', None, {'-n' : '3'}], ['a', '-n', 'X'])
Exemplo n.º 26
0
def test_match_command_trailing_files_not_expected():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a', 'b'], ['a', '-b', 'filename'])
Exemplo n.º 27
0
def test_constraint_regexp_mismatch():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a', 'n:', None, {'-n' : re.compile(r'^aaa$')}], ['a', '-n', 'bbb'])
Exemplo n.º 28
0
def test_match_command_trailing_files_star_allowed_two_provided():
    _cmdline_match_command(ps(), ['a', 'b', '*'], ['a', '-b', 'file1', 'file2'])
Exemplo n.º 29
0
def test_constraint_callable_mismatch():
    with pytest.raises(TF):
        _cmdline_match_command(ps(), ['a', 'n:', None, {'-n' : lambda x: len(x) == 1}], ['a', '-n', 'XYZ'])
Exemplo n.º 30
0
def test_match_command_trailing_files_not_expected():
    with pytest.raises(Exception):
        _cmdline_match_command(State(), ['a', 'b'], ['a', '-b', 'filename'])