MCPcopy Index your code
hub / github.com/waleedka/hiddenlayer / test_directed_graph

Method test_directed_graph

tests/test_ge.py:87–100  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

85
86class TestGraph(unittest.TestCase):
87 def test_directed_graph(self):
88 g = hl.Graph()
89 g.add_node("a")
90 g.add_node("b")
91 g.add_node("c")
92 g.add_edge("a", "b")
93 g.add_edge("b", "c")
94
95 self.assertEqual(g.incoming("b")[0], "a")
96 self.assertEqual(g.outgoing("b")[0], "c")
97 g.replace(["b"], "x")
98 self.assertEqual(sorted(list(g.nodes.values())), sorted(["a", "c", "x"]))
99 self.assertEqual(g.incoming("x")[0], "a")
100 self.assertEqual(g.outgoing("x")[0], "c")
101
102
103class TestPatterns(unittest.TestCase):

Callers

nothing calls this directly

Calls 5

add_nodeMethod · 0.95
add_edgeMethod · 0.95
incomingMethod · 0.95
outgoingMethod · 0.95
replaceMethod · 0.95

Tested by

no test coverage detected