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')])
def test_constraints_str_regex_mismatch():
    with pytest.raises(TF):
        tc_check_constraints(ps(), 'CMD', {'-a': rxc(r'ab+c')}, [('-a', 'b')])
def test_constraints_str_multiple_one_mismatch():
    with pytest.raises(TF):
        tc_check_constraints(ps(), 'CMD', {
            '-a': '1',
            '-b': '2'
        }, [('-a', '1'), ('-b', '999')])
def test_constraints_str_regex_match():
    tc_check_constraints(ps(), 'CMD', {'-a': rxc(r'ab+c')}, [('-a', 'abbbc')])
def test_constraints_str_repeated_actual_mismatch():
    with pytest.raises(TF):
        tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [('-a', '1'),
                                                        ('-a', '999')])
def test_constraints_str_multiple_match():
    tc_check_constraints(ps(), 'CMD', {
        '-a': '1',
        '-b': '2'
    }, [('-a', '1'), ('-b', '2')])
def test_constraints_str_single_mismatch_arg():
    with pytest.raises(TF):
        tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [('-a', '999')])
def test_constraints_str_repeated_actual_match():
    tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [('-a', '1'), ('-a', '1')])
def test_constraints_str_single_mismatch_option():
    tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [('-b', '1')])
Example #10
0
def test_constraints_str_single_match():
    tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [('-a', '1')])
Example #11
0
def test_constraints_str_nonempty_empty_passes():
    tc_check_constraints(ps(), 'CMD', {'-a': '1'}, [])
Example #12
0
def test_constraints_str_empty_nonempty_passes():
    tc_check_constraints(ps(), 'CMD', {}, [('-a', '1')])
Example #13
0
def test_constraints_empty_empty_passes():
    tc_check_constraints(ps(), 'CMD', {}, [])