def test_auto_io():
    """ Test auto io"""
    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, val3id, 0)
    sg.connect(val2id, 0, val3id, 0)

    sgfactory = CompositeNodeFactory("testlautoio")
    sg.to_factory(sgfactory, listid=[val1id, val2id, val3id], auto_io=True)

    # allocate the compositenode
    sg = sgfactory.instantiate()
    assert sg.get_nb_input() == 2
    assert sg.get_nb_output() == 1
    sg.set_input(0, "to")
    sg.set_input(1, "to")

    sg()
    res = sg.get_output(0)
    assert ''.join(eval(res)) == "toto"
Beispiel #2
0
    def test_auto_io(self):
        """ Test auto io"""
        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, val3id, 0)
        sg.connect(val2id, 0, val3id, 0)

        sgfactory = CompositeNodeFactory("testlautoio")
        sg.to_factory(sgfactory, listid=[val1id, val2id, val3id], auto_io=True)

        # allocate the compositenode
        sg = sgfactory.instantiate()
        assert sg.get_nb_input() == 2
        assert sg.get_nb_output() == 1
        sg.set_input(0, "to")
        sg.set_input(1, "to")

        sg()
        res = sg.get_output(0)
        assert ''.join(eval(res)) == "toto"
Beispiel #3
0
def test_auto_io():
    """ Test auto io"""
    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, val3id, 0)
    sg.connect(val2id, 0, val3id, 0)

    sgfactory = CompositeNodeFactory("testlautoio")
    sg.to_factory(sgfactory, listid=[val1id, val2id, val3id], auto_io=True)

    # allocate the compositenode
    sg = sgfactory.instantiate()
    assert sg.get_nb_input() == 2
    assert sg.get_nb_output() == 1
    sg.set_input(0, "to")
    sg.set_input(1, "to")

    sg()
    res = sg.get_output(0)
    assert ''.join(eval(res)) == "toto"