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'
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'
def project(self): projectdir = self.editor_projectdir.value() name = self.editor_name.value() metadata = self.metadata() project = create_project(name, projectdir, **metadata) return project