def test_multi_root(self): self.do_wiring() other_root = Node('dual_root') other_root.add_downstream(self.top_node._downstream_nodes[0]) with self.assertRaises(ValueError): other_root.top_node
def test_non_node_connect(self): node = Node('a') other = 'not a node' with self.assertRaises(ValueError): node.add_downstream(other)
def do_explicit_wiring(self): # define nodes a = Node('a') b = Node('b') c = Node('c') d = Node('d') e = Node('e') f = Node('f') g = Node('g') h = Node('h') i = Node('i') j = Node('j') k = Node('k') l = Node('l') m = Node('m') n = Node('n') # save a list of all nodes self.node_list = [a, b, c, d, e, f, g, h, i, j, k, l, m, n] self.top_node = a # wire up the nodes a.add_downstream(b) a.add_downstream(c) c.add_downstream(d) c.add_downstream(e) e.add_downstream(f) e.add_downstream(g) e.add_downstream(h) e.add_downstream(i) f.add_downstream(j) g.add_downstream(j) h.add_downstream(j) i.add_downstream(j) d.add_downstream(k) j.add_downstream(k) b.add_downstream(l) k.add_downstream(l) l.add_downstream(m) l.add_downstream(n)