def test_chunk_multi_filename_mismatch():
    with pytest.raises(TF):
        tc_check_chunk(ps(), ['a', '', ['x', 'y', rxc(r'zz+')]],
                       'a x y zqqz'.split())
def test_chunk_filename_mismatch():
    with pytest.raises(TF):
        tc_check_chunk(ps(), ['a', '', ['x']], 'a y'.split())
def test_chunk_multi_filename_match():
    tc_check_chunk(ps(), ['a', '', ['x', 'y', rxc(r'zz+')]],
                   'a x y zzzzzzz'.split())
def test_chunk_arg_option_value_pattern_mismatch():
    with pytest.raises(TF):
        tc_check_chunk(ps(), ['a', 'b:', [], {
            '-b': rxc(r'ab+c')
        }], 'a -b x'.split())
def test_chunk_filename_match():
    tc_check_chunk(ps(), ['a', '', ['x']], 'a x'.split())
def test_chunk_command_name_only_mismatch():
    with pytest.raises(TF):
        tc_check_chunk(ps(), ['a'], 'b'.split())
def test_chunk_arg_option_value_pattern_match():
    tc_check_chunk(ps(), ['a', 'b:', [], {
        '-b': rxc(r'ab+c')
    }], 'a -b abbbc'.split())
def test_chunk_arg_option_match():
    tc_check_chunk(ps(), ['a', 'b:'], 'a -b xyz'.split())
def test_chunk_arg_option_value_match():
    tc_check_chunk(ps(), ['a', 'b:', [], {'-b': 'xyz'}], 'a -b xyz'.split())
def test_chunk_bare_option_mismatch():
    with pytest.raises(AssertionError):
        tc_check_chunk(ps(), ['a', 'b'], 'a -c'.split())
def test_chunk_bare_option_allowed():
    tc_check_chunk(ps(), ['a', 'bc'], 'a -c'.split())
def test_chunk_bare_option_match():
    tc_check_chunk(ps(), ['a', 'b'], 'a -b'.split())
def test_chunk_no_options_allowed_mismatch():
    with pytest.raises(AssertionError):
        tc_check_chunk(ps(), ['a', None], 'a -b'.split())
def test_chunk_no_options_allowed_match():
    tc_check_chunk(ps(), ['a', None], 'a'.split())
def test_chunk_args_and_filenames_match():
    tc_check_chunk(ps(), [['a', 'b'], 'c:d', ['p', {'q', 'r'}, 's'], {
        '-c': 'NNN'
    }], 'a b -c NNN -d p r q s'.split())
def test_chunk_arg_option_value_mismatch():
    with pytest.raises(TF):
        tc_check_chunk(ps(), ['a', 'b:', [], {
            '-b': 'xyz'
        }], 'a -b pqr'.split())
def test_chunk_args_and_filenames_filename_mismatch():
    with pytest.raises(TF):
        tc_check_chunk(ps(), [['a', 'b'], 'c:d', ['p', 'q', 'r', 's'], {
            '-c': 'NNN'
        }], 'a b -c NNN -d p r q s'.split())
def test_chunk_command_name_only_match():
    tc_check_chunk(ps(), ['a'], 'a'.split())