Esempio n. 1
0
def test_add_and_remove_dep():
    dep_dic = {'A': [], 'B': [['A']], 'C': [['D', 'G'], ['A']],
               'D': [['A'], ['C', 'G']], 'E': [['D', 'G'], ['A'], ['C']],
               'F': [['A'], ['B']], 'G': [['A'], ['C', 'D']]}
    dependencies = Dependencies(dep_dic)
    dependencies.add_dep('B', ['C'])
    assert_equal_dependency_dics(dependencies.serialize(),
                                 {'A': [], 'B': [['A'], ['C']], 'C': [['D', 'G'], ['A']],
                                  'D': [['A'], ['C', 'G']], 'E': [['D', 'G'], ['A'], ['C']],
                                  'F': [['A'], ['B']], 'G': [['A'], ['C', 'D']]})
    dependencies.remove_dep('B', ['C'])
    assert_equal_dependency_dics(dependencies.serialize(), dep_dic)
Esempio n. 2
0
def test_from_rels():
    dep_dic = {
        'A': [['B']], 'B': [['E'], ['A', 'D']], 'C': [['E', 'F']],
        'D': [['A']], 'E': [['A']], 'F': [['G']], 'G': []}
    dependencies = Dependencies(dep_dic)
    rels = dependencies.tuple_relations()
    dependencies_new = Dependencies.from_rels(rels)
    assert dependencies.serialize() == dependencies_new.serialize()
Esempio n. 3
0
def test_remove_implied_extroneous():
    dep_dic = {'A': [], 'B': [['A']], 'C': [['A', 'B']]}
    dependencies = Dependencies(dep_dic)
    dependencies.remove_implied_extroneous()
    assert dependencies.serialize() == {'A': [], 'B': [['A']], 'C': [['A']]}