コード例 #1
0
def test_save_workspace():
    pm = PackageManager()
    pm.init()

    asession = Session()

    import sys

    sgfactory = CompositeNodeFactory(name="SubGraphExample",
                                description= "Examples",
                                category = "Examples",
                               )
    sg= CompositeNode()
    # build the subgraph factory

    addid = sg.add_node(pm.get_node("pkg_test", "float"))
    sg.to_factory(sgfactory)
    instance = sgfactory.instantiate()

    instance.actor(addid).set_input(0, 3)
    asession.add_workspace(instance)

    asession.save('test.pic')

    asession.workspaces = []
    asession.load('test.pic')
    try:
        os.remove('test.pic')
    except:
        os.remove('test.pic.db')

    i = asession.workspaces[0]
    assert type(i) == type(instance)
コード例 #2
0
ファイル: test_session.py プロジェクト: shiva16/openalea
def test_save_workspace():
    pm = PackageManager()
    pm.init()

    asession = Session()

    import sys

    sgfactory = CompositeNodeFactory(
        name="SubGraphExample",
        description="Examples",
        category="Examples",
    )
    sg = CompositeNode()
    # build the subgraph factory

    addid = sg.add_node(pm.get_node("pkg_test", "float"))
    sg.to_factory(sgfactory)
    instance = sgfactory.instantiate()

    instance.actor(addid).set_input(0, 3)
    asession.add_workspace(instance)

    asession.save('test.pic')

    asession.workspaces = []
    asession.load('test.pic')
    try:
        os.remove('test.pic')
    except:
        os.remove('test.pic.db')

    i = asession.workspaces[0]
    assert type(i) == type(instance)
コード例 #3
0
def test_save_datapool():

    asession = Session()
    datapool = asession.datapool

    datapool['i'] = [1, 2, 3]

    add_user_class(datapool)
    asession.save('test.pic')

    asession.datapool.clear()
    asession.load('test.pic')

    assert asession.datapool['i'] == [1, 2, 3]
    try:
        os.remove('test.pic')
    except:
        os.remove('test.pic.db')
コード例 #4
0
ファイル: test_session.py プロジェクト: shiva16/openalea
def test_save_datapool():

    asession = Session()
    datapool = asession.datapool

    datapool['i'] = [1, 2, 3]

    add_user_class(datapool)
    asession.save('test.pic')

    asession.datapool.clear()
    asession.load('test.pic')

    assert asession.datapool['i'] == [1, 2, 3]
    try:
        os.remove('test.pic')
    except:
        os.remove('test.pic.db')