Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
def test_simple_unsatisfiable():
    with assert_raises(TypeError):
        res = tyeval('a -> a -> b', [1, False], [ints, ints], PythonT)
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
def test_simple_bi_free():
    res = tyeval('a -> a -> b', [1, 2], [ints, ints], PythonT)
    assert res.dynamic == True
Ejemplo n.º 6
0
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
Ejemplo n.º 7
0
def test_simple_uni():
    res = tyeval('a -> a', [1], [ints], PythonT)
    assert res.dom == [int]
    assert res.cod == int