Example #1
0
 def test_unlink(self):
     # Assert remove all edges to/from Node(a).
     g = graph.Graph()
     g.add_edge("a", "b")
     g.add_edge("a", "c")
     graph.unlink(g, g["a"])
     self.assertTrue(len(g.edges) == 0)
     # Assert remove edges between Node(a) and Node(b)
     g = graph.Graph()
     g.add_edge("a", "b")
     g.add_edge("a", "c")
     graph.unlink(g, g["a"], "b")
     self.assertTrue(len(g.edges) == 1)
     print "pattern.graph.unlink()"
Example #2
0
 def test_unlink(self):
     # Assert remove all edges to/from Node(a).
     g = graph.Graph()
     g.add_edge("a", "b")
     g.add_edge("a", "c")
     graph.unlink(g, g["a"])
     self.assertTrue(len(g.edges) == 0)
     # Assert remove edges between Node(a) and Node(b)
     g = graph.Graph()
     g.add_edge("a", "b")
     g.add_edge("a", "c")
     graph.unlink(g, g["a"], "b")
     self.assertTrue(len(g.edges) == 1)
     print "pattern.graph.unlink()"