MCPcopy
hub / github.com/waleedka/hiddenlayer / test_prune

Method test_prune

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

Source from the content-addressed store, hash-verified

261 self.assertEqual(g.outgoing(g["a"])[0].op, "bcde")
262
263 def test_prune(self):
264 g = hl.Graph()
265 a = hl.Node(uid="a", name="a", op="a")
266 b = hl.Node(uid="b", name="b", op="b")
267 c = hl.Node(uid="c", name="c", op="c")
268 d = hl.Node(uid="d", name="d", op="d")
269 e = hl.Node(uid="e", name="e", op="e")
270 g.add_node(a)
271 g.add_node(b)
272 g.add_node(c)
273 g.add_node(d)
274 g.add_node(e)
275 g.add_edge(a, b)
276 g.add_edge(b, c)
277 g.add_edge(a, d)
278 g.add_edge(c, e)
279 g.add_edge(d, e)
280
281 t = ht.Prune("e")
282 g = t.apply(g)
283 self.assertFalse(g.outgoing(d))
284
285 def test_prune_branch(self):
286 g = hl.Graph()

Callers

nothing calls this directly

Calls 4

add_nodeMethod · 0.95
add_edgeMethod · 0.95
applyMethod · 0.95
outgoingMethod · 0.95

Tested by

no test coverage detected