コード例 #1
0
ファイル: test_matcher.py プロジェクト: Uberspace/libestg3b
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
ファイル: test_matcher.py プロジェクト: Uberspace/libestg3b
def test_rule_call_rtn_type(impl):
    m = Rule('A', 'a', impl, add=Decimal('1'))
    m.match(None, None, None)
コード例 #3
0
ファイル: test_matcher.py プロジェクト: Uberspace/libestg3b
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
ファイル: test_matcher.py プロジェクト: Uberspace/libestg3b
def test_rule_init():
    m = Rule('A', 'a', lambda x: False, add=Decimal('1'))
    m.match(None, None, None)