예제 #1
0
파일: __init__.py 프로젝트: bbonf/matcha
def test_infer_argument():
    func, _ = function(0)(
        'def double(x):\n'
        '    return x * 2')

    ret, constrains = infer_function(func)
    eq_(ret, SymbolType('x'))
    eq_(constrains, {(SymbolType('x'), Types.Integer)})
예제 #2
0
파일: __init__.py 프로젝트: bbonf/matcha
def test_infer_function():
    func, _ = function(0)(
        'def just_two(x):\n'
        '    if x > 5:\n'
        '        return 3\n'
        '    return 2')

    eq_(infer_function(func), (Types.Integer, {(SymbolType('x'), Types.Integer)}))