コード例 #1
0
ファイル: test_model.py プロジェクト: gbaty/openalea
import copy

from openalea.core.model import Model
from openalea.core.service.control import clear_controls, control_namespace
from openalea.core.service.project import create_project
from openalea.oalab.model.parse import InputObj, OutputObj


project = create_project('unittest', '/tmp/notwritable')


def register_model(model):
    project.add('model', model)


def test_copy():
    m = Model(name='m1')
    m.set_step_code('c=a+b')
    m.inputs_info = [InputObj('a'), InputObj('b')]
    m.outputs_info = [OutputObj('c')]

    m2 = copy.copy(m)
    assert m is not m2
    assert m.step_code == m2.step_code
    assert [inp.name for inp in m2.inputs_info] == ['a', 'b']
    assert [out.name for out in m2.outputs_info] == ['c']


def test_output():
    step_code = 'c=a+b'
コード例 #2
0
import copy

from openalea.core.model import Model
from openalea.core.service.control import clear_controls, control_namespace
from openalea.core.service.project import create_project

from openalea.core.model_inout import InputObj, OutputObj

project = create_project('unittest', '/tmp/notwritable')


def register_model(model):
    project.add('model', model)


def test_copy():
    m = Model(name='m1')
    m.set_step_code('c=a+b')
    m.inputs_info = [InputObj('a'), InputObj('b')]
    m.outputs_info = [OutputObj('c')]

    m2 = copy.copy(m)
    assert m is not m2
    assert m.step_code == m2.step_code
    assert [inp.name for inp in m2.inputs_info] == ['a', 'b']
    assert [out.name for out in m2.outputs_info] == ['c']


def test_output():
    step_code = 'c=a+b'
コード例 #3
0
 def project(self):
     projectdir = self.editor_projectdir.value()
     name = self.editor_name.value()
     metadata = self.metadata()
     project = create_project(name, projectdir, **metadata)
     return project