def test_multi_out_eval(): """ Test multiple out connection""" pm = PackageManager() pm.init() sg = CompositeNode() # build the compositenode factory val1id = sg.add_node(pm.get_node("Catalog.Data", "string")) val2id = sg.add_node(pm.get_node("Catalog.Data", "string")) val3id = sg.add_node(pm.get_node("Catalog.Data", "string")) sg.connect(val1id, 0, val2id, 0) sg.connect(val1id, 0, val3id, 0) sgfactory = CompositeNodeFactory("testlazyeval") sg.to_factory(sgfactory) # allocate the compositenode sg = sgfactory.instantiate() sg.node(val1id).set_input(0, "teststring") sg() assert sg.node(val2id).get_output(0) == "teststring" assert sg.node(val3id).get_output(0) == "teststring" #partial evaluation sg.node(val1id).set_input(0, "teststring2") sg.eval_as_expression(val2id) assert sg.node(val2id).get_output(0) == "teststring2" sg.eval_as_expression(val3id) assert sg.node(val3id).get_output(0) == "teststring2"
def test_multi_out_eval(self): """ Test multiple out connection""" sg = CompositeNode() # build the compositenode factory val1id = sg.add_node(self.string_node) val2id = sg.add_node(self.string_node) val3id = sg.add_node(self.string_node) sg.connect(val1id, 0, val2id, 0) sg.connect(val1id, 0, val3id, 0) sgfactory = CompositeNodeFactory("testlazyeval") sg.to_factory(sgfactory) # allocate the compositenode sg = sgfactory.instantiate() sg.node(val1id).set_input(0, "teststring") sg() assert sg.node(val2id).get_output(0) == "teststring" assert sg.node(val3id).get_output(0) == "teststring" #partial evaluation sg.node(val1id).set_input(0, "teststring2") sg.eval_as_expression(val2id) assert sg.node(val2id).get_output(0) == "teststring2" sg.eval_as_expression(val3id) assert sg.node(val3id).get_output(0) == "teststring2"