Exemplo n.º 1
0
def test_triples():
    assert len(triples(relationships([sequential('a', 'b'),
                                      sequential('b', 'c')])).items()) == 1

    assert len(triples(relationships([sequential('a', 'b'),
                                      sequential('b', 'c'),
                                      sequential('c', 'd')])).items()) == 2
Exemplo n.º 2
0
def test_occurrence():
    occ = occurrence(relationships([simultaneous('a', 'b')]))
    print('occurrence: ', occ)
    formula = and_(simultaneous('a', 'b'), not_(var('a')), *occ)
    print('formula: ', formula)
    s = formula.sat()[1]
    if s:
        print('solution: ', [k for k, v in s.items() if v])
    assert not s
Exemplo n.º 3
0
def test_timeline():
    statements = [simultaneous('a', 'b'), sequential('b', 'a')]
    t = timeline(relationships(statements))
    print('timeline: ', t)
    formula = and_(var('a'), var('b'), *(t + statements))
    print('formula: ', formula)
    s = formula.sat()[1]
    if s:
        print('solution: ', [k for k, v in s.items() if v])
    assert not s
Exemplo n.º 4
0
 def trans(s):
     return transitivity(triples(relationships(s)))
Exemplo n.º 5
0
def test_relationships():
    statements = [simultaneous('a', 'b'), sequential('a', 'b')]
    rs = relationships(statements)
    assert ('a', 'b') in rs and len(rs[('a', 'b')]) == 2