示例#1
0
def test_rule_call_passing_1():
    args = None

    def impl(a):
        nonlocal args
        args = [a]
        return True

    m = Rule('A', 'a', impl, add=Decimal('1'))
    m.match(0, 1, 2)
    assert args == [0]
示例#2
0
def test_rule_call_rtn_type(impl):
    m = Rule('A', 'a', impl, add=Decimal('1'))
    m.match(None, None, None)
示例#3
0
def test_rule_call_rtn_type_crash():
    m = Rule('A', 'a', lambda x: None, add=Decimal('1'))
    with pytest.raises(AssertionError):
        m.match(None, None, None)
示例#4
0
def test_rule_init():
    m = Rule('A', 'a', lambda x: False, add=Decimal('1'))
    m.match(None, None, None)