示例#1
0
def test_constraints_everything_match():
    tc_check_constraints(ps(), 'CMD', {
        '-a': '1',
        '-b': rxc(r'ab+c'),
        '-c': lambda x: int(x) > 5,
        '-d': 'xyz'
    }, [('-c', '99'), ('-b', 'abbbc'), ('-e', 'not checked')])
示例#2
0
def test_constraints_str_regex_mismatch():
    with pytest.raises(TF):
        tc_check_constraints(ps(), 'CMD', {'-a': rxc(r'ab+c')}, [('-a', 'b')])
示例#3
0
def test_constraints_str_multiple_one_mismatch():
    with pytest.raises(TF):
        tc_check_constraints(ps(), 'CMD', {
            '-a': '1',
            '-b': '2'
        }, [('-a', '1'), ('-b', '999')])
示例#4
0
def test_constraints_str_regex_match():
    tc_check_constraints(ps(), 'CMD', {'-a': rxc(r'ab+c')}, [('-a', 'abbbc')])
示例#5
0
def test_constraints_str_repeated_actual_mismatch():
    with pytest.raises(TF):
        tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [('-a', '1'),
                                                        ('-a', '999')])
示例#6
0
def test_constraints_str_multiple_match():
    tc_check_constraints(ps(), 'CMD', {
        '-a': '1',
        '-b': '2'
    }, [('-a', '1'), ('-b', '2')])
示例#7
0
def test_constraints_str_single_mismatch_arg():
    with pytest.raises(TF):
        tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [('-a', '999')])
示例#8
0
def test_constraints_str_repeated_actual_match():
    tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [('-a', '1'), ('-a', '1')])
示例#9
0
def test_constraints_str_single_mismatch_option():
    tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [('-b', '1')])
示例#10
0
def test_constraints_str_single_match():
    tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [('-a', '1')])
示例#11
0
def test_constraints_str_nonempty_empty_passes():
    tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [])
示例#12
0
def test_constraints_str_empty_nonempty_passes():
    tc_check_constraints(ps(), 'CMD', {}, [('-a', '1')])
示例#13
0
def test_constraints_empty_empty_passes():
    tc_check_constraints(ps(), 'CMD', {}, [])