示例#1
0
def test_process_with_false_condition(patch_schema):
    patch_schema(SCHEMA)
    data = """
Si c'est un bénéficiaire de droit privé
    Alors la rémunération applicable vaut 40
"""
    tree = Rule.load(data.splitlines(), name='foo')[0]
    context = {'droit_prive': False}
    Rule.process(tree, context)
    assert 'remuneration' not in context
示例#2
0
def test_process_with_indented_condition(patch_schema):
    patch_schema(SCHEMA)
    data = """
Si c'est un bénéficiaire de droit privé
    Si c'est une formation éligible CPF
        Alors la rémunération applicable vaut 40
"""
    tree = Rule.load(data.splitlines(), name='foo')[0]
    context = {'droit_prive': True, 'copanef': True}
    Rule.process(tree, context)
    assert context['remuneration'] == 40
示例#3
0
def test_process_with_false_sibling(patch_schema):
    patch_schema(SCHEMA)
    data = """
Si c'est un bénéficiaire de droit privé
    Si c'est une formation éligible CPF
        Alors la rémunération applicable vaut 40
    Si c'est un permis B
        Alors le prix horaire applicable vaut 20
"""
    tree = Rule.load(data.splitlines(), name='foo')[0]
    context = {'droit_prive': True, 'copanef': False, 'permis_b': True}
    Rule.process(tree, context)
    assert 'remuneration' not in context
    assert context['prix'] == 20