Exemplo n.º 1
0
def test_find_trans_deps():
    dep_dic = {
        'A': [], 'B': [], 'C': [], 'D': [['F']],
        'E': [['A', 'B', 'C', 'D']], 'F': [['A', 'B']]}
    dep = Dependencies(dep_dic, ['A', 'B', 'C'])
    dep.remove_implied_extroneous()
    assert dep.find_trans_deps() == [(['F'], 'D')]
Exemplo n.º 2
0
def test_find_candidate_keys():
    dep_dic = {
        'A': [['B']], 'B': [['E'], ['A', 'D']], 'C': [['E', 'F']],
        'D': [['A']], 'E': [['A']], 'F': [['G']], 'G': []}
    dependencies = Dependencies(dep_dic)
    dependencies.remove_implied_extroneous()
    assert_equal_cand_keys(dependencies.find_candidate_keys(), [{'A', 'G'}, {'B', 'G'}, {'E', 'G'}])
Exemplo n.º 3
0
def test_find_partial_deps():
    dep_dic = {
        'A': [['B']], 'B': [['E'], ['A', 'D']], 'C': [['E', 'F']],
        'D': [['A']], 'E': [['A']], 'F': [['G']], 'G': []}
    dependencies = Dependencies(dep_dic, ['A', 'G'])
    dependencies.remove_implied_extroneous()
    partial_deps = [(['A'], 'D'), (['G'], 'F'), (['A'], 'B'), (['A'], 'E')]
    assert_equal_tuple_rels(dependencies.find_partial_deps(), partial_deps)
Exemplo n.º 4
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']]}