Skip to content

Commit

Permalink
FIX : Fixing #17, removing the 'remove' function from Edge as it is n…
Browse files Browse the repository at this point in the history
…ot used
  • Loading branch information
Adelme Bazin committed Nov 7, 2019
1 parent 24c72c4 commit 491855d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
4 changes: 0 additions & 4 deletions ppanggolin/pangenome.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ def addGenes(self, sourceGene, targetGene):
raise Exception(f"You tried to create an edge between two genes that are not even in the same organism ! (genes are '{sourceGene.ID}' and '{targetGene.ID}')")
self.organisms[org].append((sourceGene, targetGene))

def remove(self):
self.source._edges[self.target].discard(self)
self.target._edges[self.source].discard(self)

class GeneFamily:
def __init__(self, ID, name):
self.name = name
Expand Down
29 changes: 1 addition & 28 deletions tests/pangenome/test_Edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,31 +132,4 @@ def test_genePairs(make_gene_pair):

# 'set' because the order is not guaranted due to '.values()'.
l_pairs = o_edge.genePairs
assert set(l_pairs) == set([p1,p2,p3,p4])


@pytest.mark.xfail(reason="#17 : Edge has not discard attr.")
def test_remove(o_edge, make_gene_pair):
org1 = "org1"
o_s1, o_t1 = make_gene_pair(org1, "s1", "t1")
o_fam1 = o_s1.family
o_fam2 = o_t1.family
o_e1 = Edge(o_s1, o_t1)
# fam1(s1) -- fam2(t1)

org2 = "org2"
o_s2 = Gene("s1_bis")
o_s2.fill_parents(org2, None)
o_fam1.addGene(o_s2)

o_t2 = Gene("t2")
o_t2.fill_parents(org2, None)
o_fam3 = GeneFamily("fam3",None)
o_fam3.addGene(o_t2)
o_e2 = Edge(o_s2, o_t2)
# fam1(s1,s2) -- fam3(t2)

o_e1.remove()
assert o_fam1.edges == set([o_e2])
assert o_fam2.edges == set()
assert o_fam3.edges == set([o_e2])
assert set(l_pairs) == set([p1,p2,p3,p4])

0 comments on commit 491855d

Please sign in to comment.