コード例 #1
0
ファイル: test_typecheck.py プロジェクト: pelson/blaze
def test_simple_unification():
    res = tyeval('a -> a -> a', [1, 3.14], [numerics, numerics], PythonT)
    assert res.dom     == [float, float]
    assert res.cod     == float
    assert res.dynamic == False
コード例 #2
0
ファイル: test_typecheck.py プロジェクト: pelson/blaze
def test_complext_unification():
    res = tyeval('a -> b -> a -> b', [1, False, 2], \
            [numerics, bools, numerics, bools], PythonT)
    assert res.dom     == [int, bool, int]
    assert res.cod     == bool
    assert res.dynamic == False
コード例 #3
0
ファイル: test_typecheck.py プロジェクト: pelson/blaze
def test_simple_unsatisfiable():
    with assert_raises(TypeError):
        res = tyeval('a -> a -> b', [1, False], [ints, ints], PythonT)
コード例 #4
0
ファイル: test_typecheck.py プロジェクト: pelson/blaze
def test_simple_bi_domain():
    res = tyeval('a -> a -> a', [1, 2], [numerics, numerics], PythonT)
    assert res.dom     == [int, int]
    assert res.cod     == int
    assert res.dynamic == False
コード例 #5
0
ファイル: test_typecheck.py プロジェクト: pelson/blaze
def test_simple_bi_free():
    res = tyeval('a -> a -> b', [1, 2], [ints, ints], PythonT)
    assert res.dynamic == True
コード例 #6
0
ファイル: test_typecheck.py プロジェクト: pelson/blaze
def test_simple_bi():
    res = tyeval('a -> a -> a', [1, 2], [ints, ints], PythonT)
    assert res.dom     == [int, int]
    assert res.cod     == int
    assert res.dynamic == False
コード例 #7
0
ファイル: test_typecheck.py プロジェクト: pelson/blaze
def test_simple_uni():
    res = tyeval('a -> a', [1], [ints], PythonT)
    assert res.dom == [int]
    assert res.cod == int