예제 #1
0
def test_bind3():
    t1 = T('SP(A;1)')
    t2 = T('C')
    m = t1.match_expr(t2)
    print format_variables(m)
    assert len(m) == 1 
    assert m['C'] == T('SP(A;1)')
예제 #2
0
def test_bind_implicit1():
    t1 = T('BB(A;{0,1};A)')
    # we should be able to get that A 
    # should be a Space and a number    
    t2 = T('BB(X;Y;Z)')
    print t1
    print t2

    m = t1.match_expr(t2)
    print format_variables(m)
예제 #3
0
def test_bind5():
    t1 = T('A x A')
    t2 = T('C x {0,2}')
    m = t1.match_expr(t2)
    print
    print t1
    print t2
    print format_variables(m)
    assert len(m) == 1
    assert m['A'] == T('C∩{0,2}') 
예제 #4
0
def test_bind4():
    t1 = T('A->(B x A)')
    t2 = T('C->({0,2}x{0,1})')
    print t1
    print t2
    m = t1.match_expr(t2)
    print format_variables(m)
    assert len(m) == 2
    assert m['A'] == T('C∩{0,1}')
    assert m['B'] == T('{0,2}')