def test_project_export_import(self): proj = Project(os.path.join(self.tdir, 'proj1')) self.assertEqual(proj.config.items('info'), [('version', '0'), ('description', '')]) new_info = [('version', 'stinky'), ('description', 'Frobozz rulz!')] proj.set_info(dict(new_info)) proj.activate() self._fill_project(proj) proj.export(destdir=self.tdir) proj.deactivate() newproj = project_from_archive(os.path.join(self.tdir, 'proj1%s' % PROJ_FILE_EXT), proj_name='proj2', dest_dir=self.tdir) self.assertEqual(newproj.path, os.path.join(self.tdir, 'proj2')) self.assertEqual(newproj.config.items('info'), new_info) try: newproj = project_from_archive(os.path.join(self.tdir, 'proj1%s' % PROJ_FILE_EXT), dest_dir=self.tdir) except Exception, err: self.assertTrue(str(err).endswith(' already exists'))
def test_project_export_import(self): proj = Project(os.path.join(self.tdir, 'proj1')) self.assertEqual(proj.config.items('info'), [('version', '0'), ('description', '')]) new_info = [('version', 'stinky'), ('description', 'Frobozz rulz!')] proj.set_info(dict(new_info)) proj.activate() self._fill_project(proj) proj.export(destdir=self.tdir) proj.deactivate() newproj = project_from_archive(os.path.join(self.tdir, 'proj1%s' % PROJ_FILE_EXT), proj_name='proj2', dest_dir=self.tdir) self.assertEqual(newproj.path, os.path.join(self.tdir, 'proj2')) self.assertEqual(newproj.config.items('info'), new_info) try: newproj = project_from_archive(os.path.join( self.tdir, 'proj1%s' % PROJ_FILE_EXT), dest_dir=self.tdir) except Exception, err: self.assertTrue(str(err).endswith(' already exists'))
def test_execfile(self): # execfile an input file (with a __main__) and make sure you # can save the project without any errors proj_file = os.path.join(self.path, 'simple_1.proj') proj_copy = os.path.join(self.tdir, 'simple_2.proj') shutil.copyfile(proj_file, proj_copy) project_from_archive(proj_copy) self.cserver.load_project(os.path.join(self.tdir, 'simple_2')) self.cserver.execfile('optimization_constrained.py') self.cserver.commit_project() self.cserver.cleanup() os.remove(proj_copy)
def test_project_export_import(self): proj = Project(os.path.join(self.tdir, 'proj1')) self._fill_project(proj.top) proj.export(destdir=self.tdir) proj.deactivate() newproj = project_from_archive(os.path.join(self.tdir, 'proj1%s' % PROJ_FILE_EXT), proj_name='proj2', dest_dir=self.tdir) self.assertEqual(newproj.path, os.path.join(self.tdir, 'proj2')) try: newproj = project_from_archive(os.path.join(self.tdir, 'proj1%s' % PROJ_FILE_EXT), dest_dir=self.tdir) except Exception, err: self.assertTrue(str(err).endswith(' already exists'))
def test_project_export_import(self): proj = Project(os.path.join(self.tdir, 'proj1')) self._fill_project(proj.top) proj.export(destdir=self.tdir) proj.deactivate() newproj = project_from_archive(os.path.join(self.tdir, 'proj1%s' % PROJ_FILE_EXT), proj_name='proj2', dest_dir=self.tdir) self.assertEqual(newproj.path, os.path.join(self.tdir, 'proj2')) try: newproj = project_from_archive(os.path.join( self.tdir, 'proj1%s' % PROJ_FILE_EXT), dest_dir=self.tdir) except Exception, err: self.assertTrue(str(err).endswith(' already exists'))
def revert(self, commit_id=None): for projfile in os.listdir(self.repodir): if projfile.endswith(PROJ_FILE_EXT): # first, clean up existing project dir for f in os.listdir('.'): if f == self.repodir: continue try: if os.path.isdir(f): shutil.rmtree(f) else: os.remove(f) except Exception as err: print str(err) # now untar the project archive over the current project directory project_from_archive(os.path.join(os.getcwd(), self.repodir, projfile), dest_dir=os.path.dirname(os.getcwd()), create=False, overwrite=True) break else: raise RuntimeError("No project file to revert to!")
def test_using(self): proj = Project('a_proj') self._fill_project(proj.top) proj.top.run() self.assertEqual(proj.top.comp1.rval_out, 10.) self.assertEqual(proj.top.comp2.rval_out, 40.) proj.top.comp1.rval_in = 0.5 os.chdir(self.tdir) proj.export(projname='fooproj') fooproj = project_from_archive('fooproj.proj') self.assertEqual(fooproj.top.comp1.rval_in, proj.top.comp1.rval_in) fooproj.top.run() self.assertEqual(fooproj.top.comp1.rval_out, 1.) self.assertEqual(fooproj.top.comp2.rval_out, 4.)
def test_using(self): proj = Project('a_proj') proj.activate() self._fill_project(proj) top = proj.get('top') top.run() self.assertEqual(top.comp1.rval_out, 10.) self.assertEqual(top.comp2.rval_out, 40.) proj.command("top.comp1.rval_in = 0.5") os.chdir(self.tdir) proj.export(projname='fooproj') fooproj = project_from_archive('fooproj.proj') fooproj.activate() footop = fooproj.get('top') self.assertEqual(footop.comp1.rval_in, top.comp1.rval_in) footop.run() self.assertEqual(footop.comp1.rval_out, 1.) self.assertEqual(footop.comp2.rval_out, 4.)
def test_simple(self): # load and inspect the simple example project projfile = os.path.join(self.path, 'simple_1.proj') project_from_archive(projfile, dest_dir=self.tdir) # LOAD PROJECT self.cserver.load_project(os.path.join(self.tdir, 'simple_1')) # CHECK FILES files = self.cserver.get_files() self.assertTrue('/paraboloid.py'.replace('/', os.sep) in files) self.assertTrue( '/optimization_constrained.py'.replace('/', os.sep) in files) self.assertTrue( '/optimization_unconstrained.py'.replace('/', os.sep) in files) self.assertTrue('/_project_state'.replace('/', os.sep) in files) time.sleep(3.0) types = self.cserver.get_types() self.assertTrue('Paraboloid' in types) type_info = types['Paraboloid'] self.assertEqual(type_info['modpath'], 'paraboloid.Paraboloid') components = ioJSON.loads(self.cserver.get_components()) # CREATE ASSEMBLY self.cserver.put_object('prob', 'openmdao.main.assembly.Assembly') oldnum = len(components) components = ioJSON.loads(self.cserver.get_components()) self.assertEqual(len(components) - oldnum, 1) for comp in components: if comp['pathname'] == 'prob': assembly = comp break else: self.fail("prob was not found in component list") self.assertEqual(assembly['pathname'], 'prob') self.assertEqual(assembly['type'], 'Assembly') self.assertEqual(assembly['interfaces'], ['IAssembly', 'IComponent', 'IContainer']) self.assertEqual(len(assembly['children']), 1) child = assembly['children'][0] self.assertEqual(child['pathname'], 'prob.driver') self.assertEqual(child['type'], 'Driver') self.assertEqual(child['interfaces'], ['IDriver', 'IHasEvents', 'IComponent', 'IContainer']) # ADD CONMIN DRIVER self.cserver.put_object( 'prob.driver', 'openmdao.lib.drivers.conmindriver.CONMINdriver') components = ioJSON.loads(self.cserver.get_components()) self.assertEqual(len(components) - oldnum, 1) for comp in components: if comp['pathname'] == 'prob': assembly = comp break else: self.fail("prob was not found in component list") self.assertEqual(assembly['pathname'], 'prob') self.assertEqual(len(assembly['children']), 1) child = assembly['children'][0] self.assertEqual(child['pathname'], 'prob.driver') self.assertEqual(child['type'], 'CONMINdriver') self.assertEqual(child['interfaces'], [ 'IHasParameters', 'IHasIneqConstraints', 'IHasObjective', 'IOptimizer', 'IDriver', 'IHasEvents', 'IComponent', 'IContainer' ]) # CHECK DRIVER ATTRIBUTES attributes = ioJSON.loads(self.cserver.get_attributes('prob.driver')) self.assertEqual(attributes['type'], 'CONMINdriver') self.assertTrue('Inputs' in attributes) self.assertTrue('Outputs' in attributes) self.assertTrue('Objectives' in attributes) self.assertTrue('Parameters' in attributes) self.assertTrue('Constraints' in attributes) self.assertTrue('Workflow' in attributes) self.assertEqual(attributes['Workflow']['pathname'], 'prob.driver') self.assertEqual(attributes['Workflow']['type'], 'openmdao.lib.drivers.conmindriver.CONMINdriver') self.assertEqual(len(attributes['Workflow']['workflow']), 0) self.assertEqual(self.cserver.file_forces_reload('/paraboloid.py'), False) # CREATE PARABOLOID self.cserver.put_object('prob.p', 'paraboloid.Paraboloid') self.assertEqual(self.cserver.file_forces_reload('/paraboloid.py'), True) attributes = ioJSON.loads(self.cserver.get_attributes('prob.p')) self.assertEqual(attributes['type'], 'Paraboloid') self.assertTrue('Inputs' in attributes) inputs = attributes['Inputs'] names = sorted([input['name'] for input in inputs]) self.assertEqual( names, ['directory', 'force_fd', 'missing_deriv_policy', 'x', 'y']) found_x = found_y = False for item in inputs: self.assertTrue('desc' in item) self.assertTrue('name' in item) self.assertTrue('type' in item) self.assertTrue('value' in item) if item['name'] == 'x': found_x = True self.assertEqual(item['type'], 'float') self.assertEqual(item['desc'], 'The variable x') if item['name'] == 'y': found_y = True self.assertEqual(item['type'], 'float') self.assertEqual(item['desc'], 'The variable y') self.assertTrue(found_x) self.assertTrue(found_y) self.assertTrue('Outputs' in attributes) outputs = attributes['Outputs'] self.assertEqual(len(outputs), 4) found_f_xy = False for output in outputs: self.assertTrue('desc' in output) self.assertTrue('name' in output) self.assertTrue('type' in output) self.assertTrue('value' in output) if output['name'] == 'f_xy': found_f_xy = True self.assertEqual(output['type'], 'float') self.assertEqual(output['desc'], 'F(x,y)') self.assertTrue(found_f_xy) # DATAFLOW dataflow = ioJSON.loads(self.cserver.get_dataflow('prob')) self.assertEqual(len(dataflow), 6) self.assertTrue('components' in dataflow) components = dataflow['components'] self.assertEqual(len(components), 2) found_p = found_driver = False for comp in components: self.assertTrue('pathname' in comp) self.assertTrue('type' in comp) self.assertTrue('name' in comp) if comp['name'] == 'p': found_p = True self.assertEqual(comp['pathname'], 'prob.p') self.assertEqual(comp['type'], 'Paraboloid') if comp['name'] == 'driver': found_driver = True self.assertEqual(comp['pathname'], 'prob.driver') self.assertEqual(comp['type'], 'CONMINdriver') self.assertTrue(found_p) self.assertTrue(found_driver) self.assertTrue('connections' in dataflow) connections = dataflow['connections'] self.assertEqual(len(connections), 0) self.assertTrue('parameters' in dataflow) parameters = dataflow['parameters'] self.assertEqual(len(parameters), 0) self.assertTrue('constraints' in dataflow) constraints = dataflow['constraints'] self.assertEqual(len(constraints), 0) self.assertTrue('objectives' in dataflow) objectives = dataflow['objectives'] self.assertEqual(len(objectives), 0) self.assertTrue('responses' in dataflow) responses = dataflow['responses'] self.assertEqual(len(responses), 0) # WORKFLOW self.cserver.onecmd('prob.driver.workflow.add("p")') driver_flow = ioJSON.loads(self.cserver.get_workflow('prob.driver'))[0] self.assertTrue('pathname' in driver_flow) self.assertTrue('type' in driver_flow) self.assertTrue('workflow' in driver_flow) workflow = driver_flow['workflow'] self.assertEqual(len(workflow), 1) self.assertEqual(workflow[0]['pathname'], 'prob.p') self.assertEqual(workflow[0]['type'], 'paraboloid.Paraboloid')
def test_simple(self): ''' load and inspect the simple example project ''' projfile = os.path.join(self.path, 'simple_1.proj') project_from_archive(projfile, dest_dir=self.tdir) # LOAD PROJECT self.cserver.load_project(os.path.join(self.tdir, 'simple_1')) # CHECK FILES files = self.cserver.get_files() self.assertTrue('/paraboloid.py'.replace('/', os.sep) in files) self.assertTrue('/optimization_constrained.py'.replace('/', os.sep) in files) self.assertTrue('/optimization_unconstrained.py'.replace('/', os.sep) in files) self.assertTrue('/_project_state'.replace('/', os.sep) in files) time.sleep(3.0) types = self.cserver.get_types() self.assertTrue('Paraboloid' in types) type_info = types['Paraboloid'] self.assertEqual(type_info['modpath'], 'paraboloid.Paraboloid') components = json.loads(self.cserver.get_components()) # CREATE ASSEMBLY self.cserver.add_component('prob', 'openmdao.main.assembly.Assembly', '') oldnum = len(components) components = json.loads(self.cserver.get_components()) self.assertEqual(len(components) - oldnum, 1) for comp in components: if comp['pathname'] == 'prob': assembly = comp break else: self.fail("prob was not found in component list") self.assertEqual(assembly['pathname'], 'prob') self.assertEqual(assembly['type'], 'Assembly') self.assertEqual(assembly['interfaces'], ['IAssembly', 'IComponent', 'IContainer']) self.assertEqual(len(assembly['children']), 1) child = assembly['children'][0] self.assertEqual(child['pathname'], 'prob.driver') self.assertEqual(child['type'], 'Run_Once') self.assertEqual(child['interfaces'], ['IDriver', 'IHasEvents', 'IComponent', 'IContainer']) # ADD CONMIN DRIVER self.cserver.add_component('driver', 'openmdao.lib.drivers.conmindriver.CONMINdriver', 'prob') components = json.loads(self.cserver.get_components()) self.assertEqual(len(components) - oldnum, 1) for comp in components: if comp['pathname'] == 'prob': assembly = comp break else: self.fail("prob was not found in component list") self.assertEqual(assembly['pathname'], 'prob') self.assertEqual(len(assembly['children']), 1) child = assembly['children'][0] self.assertEqual(child['pathname'], 'prob.driver') self.assertEqual(child['type'], 'CONMINdriver') self.assertEqual(child['interfaces'], ['IHasParameters', 'IHasIneqConstraints', 'IHasObjective', 'IOptimizer', 'IDriver', 'IHasEvents', 'IComponent', 'IContainer']) # CHECK DRIVER ATTRIBUTES attributes = json.loads(self.cserver.get_attributes('prob.driver')) self.assertEqual(attributes['type'], 'CONMINdriver') self.assertTrue('Inputs' in attributes) self.assertTrue('Outputs' in attributes) self.assertTrue('Objectives' in attributes) self.assertTrue('Parameters' in attributes) self.assertTrue('Constraints' in attributes) self.assertTrue('Slots' in attributes) self.assertTrue('Workflow' in attributes) self.assertEqual(attributes['Workflow']['pathname'], 'prob.driver') self.assertEqual(attributes['Workflow']['type'], 'openmdao.lib.drivers.conmindriver.CONMINdriver') self.assertEqual(len(attributes['Workflow']['workflow']), 0) self.assertEqual(self.cserver.file_has_instances('/paraboloid.py'), False) # CREATE PARABOLOID self.cserver.add_component('p', 'paraboloid.Paraboloid', 'prob') self.assertEqual(self.cserver.file_has_instances('/paraboloid.py'), True) attributes = json.loads(self.cserver.get_attributes('prob.p')) self.assertEqual(attributes['type'], 'Paraboloid') self.assertTrue('Inputs' in attributes) inputs = attributes['Inputs'] self.assertEqual(len(inputs), 4) found_x = found_y = False for item in inputs: self.assertTrue('desc' in item) self.assertTrue('name' in item) self.assertTrue('type' in item) # KTM - commented this out, because none of these have units, low # or high attributes. #self.assertTrue('units' in item) #self.assertTrue('high' in item) #self.assertTrue('low' in item) self.assertTrue('valid' in item) self.assertTrue('value' in item) if item['name'] == 'x': found_x = True self.assertEqual(item['type'], 'float') self.assertEqual(item['desc'], 'The variable x') if item['name'] == 'y': found_y = True self.assertEqual(item['type'], 'float') self.assertEqual(item['desc'], 'The variable y') self.assertTrue(found_x) self.assertTrue(found_y) self.assertTrue('Outputs' in attributes) outputs = attributes['Outputs'] self.assertEqual(len(outputs), 1) found_f_xy = False for output in outputs: self.assertTrue('desc' in output) self.assertTrue('name' in output) self.assertTrue('type' in output) # KTM - commented this out, because none of these have units, low # or high attributes. #self.assertTrue('units' in output) #self.assertTrue('high' in output) #self.assertTrue('low' in output) self.assertTrue('valid' in output) self.assertTrue('value' in output) if output['name'] == 'f_xy': found_f_xy = True self.assertEqual(output['type'], 'float') self.assertEqual(output['desc'], 'F(x,y)') self.assertTrue(found_f_xy) # DATAFLOW dataflow = json.loads(self.cserver.get_dataflow('prob')) self.assertEqual(len(dataflow), 5) self.assertTrue('components' in dataflow) components = dataflow['components'] self.assertEqual(len(components), 2) found_p = found_driver = False for comp in components: self.assertTrue('pathname' in comp) self.assertTrue('type' in comp) self.assertTrue('name' in comp) if comp['name'] == 'p': found_p = True self.assertEqual(comp['pathname'], 'prob.p') self.assertEqual(comp['type'], 'Paraboloid') if comp['name'] == 'driver': found_driver = True self.assertEqual(comp['pathname'], 'prob.driver') self.assertEqual(comp['type'], 'CONMINdriver') self.assertTrue(found_p) self.assertTrue(found_driver) self.assertTrue('connections' in dataflow) connections = dataflow['connections'] self.assertEqual(len(connections), 0) self.assertTrue('parameters' in dataflow) parameters = dataflow['parameters'] self.assertEqual(len(parameters), 0) self.assertTrue('constraints' in dataflow) constraints = dataflow['constraints'] self.assertEqual(len(constraints), 0) self.assertTrue('objectives' in dataflow) objectives = dataflow['objectives'] self.assertEqual(len(objectives), 0) # WORKFLOW self.cserver.onecmd('prob.driver.workflow.add("p")') driver_flow = json.loads(self.cserver.get_workflow('prob.driver'))[0] self.assertTrue('pathname' in driver_flow) self.assertTrue('type' in driver_flow) self.assertTrue('workflow' in driver_flow) workflow = driver_flow['workflow'] self.assertEqual(len(workflow), 1) self.assertEqual(workflow[0]['pathname'], 'prob.p') self.assertEqual(workflow[0]['type'], 'paraboloid.Paraboloid')
def test_simple(self): """ load and inspect the simple example project """ projfile = os.path.join(self.path, "simple_1.proj") project_from_archive(projfile, dest_dir=self.tdir) # LOAD PROJECT self.cserver.load_project(os.path.join(self.tdir, "simple_1")) # CHECK FILES files = self.cserver.get_files() self.assertTrue("/paraboloid.py".replace("/", os.sep) in files) self.assertTrue("/optimization_constrained.py".replace("/", os.sep) in files) self.assertTrue("/optimization_unconstrained.py".replace("/", os.sep) in files) self.assertTrue("/_project_state".replace("/", os.sep) in files) time.sleep(3.0) types = self.cserver.get_types() self.assertTrue("Paraboloid" in types) type_info = types["Paraboloid"] self.assertEqual(type_info["modpath"], "paraboloid.Paraboloid") components = json.loads(self.cserver.get_components()) # CREATE ASSEMBLY self.cserver.add_component("prob", "openmdao.main.assembly.Assembly", "", "") oldnum = len(components) components = json.loads(self.cserver.get_components()) self.assertEqual(len(components) - oldnum, 1) for comp in components: if comp["pathname"] == "prob": assembly = comp break else: self.fail("prob was not found in component list") self.assertEqual(assembly["pathname"], "prob") self.assertEqual(assembly["type"], "Assembly") self.assertEqual(assembly["interfaces"], ["IAssembly", "IComponent", "IContainer"]) self.assertEqual(len(assembly["children"]), 1) child = assembly["children"][0] self.assertEqual(child["pathname"], "prob.driver") self.assertEqual(child["type"], "Run_Once") self.assertEqual(child["interfaces"], ["IDriver", "IHasEvents", "IComponent", "IContainer"]) # ADD CONMIN DRIVER self.cserver.add_component("driver", "openmdao.lib.drivers.conmindriver.CONMINdriver", "prob", "") components = json.loads(self.cserver.get_components()) self.assertEqual(len(components) - oldnum, 1) for comp in components: if comp["pathname"] == "prob": assembly = comp break else: self.fail("prob was not found in component list") self.assertEqual(assembly["pathname"], "prob") self.assertEqual(len(assembly["children"]), 1) child = assembly["children"][0] self.assertEqual(child["pathname"], "prob.driver") self.assertEqual(child["type"], "CONMINdriver") self.assertEqual( child["interfaces"], [ "IHasParameters", "IHasIneqConstraints", "IHasObjective", "IOptimizer", "IDriver", "IHasEvents", "IComponent", "IContainer", ], ) # CHECK DRIVER ATTRIBUTES attributes = json.loads(self.cserver.get_attributes("prob.driver")) self.assertEqual(attributes["type"], "CONMINdriver") self.assertTrue("Inputs" in attributes) self.assertTrue("Outputs" in attributes) self.assertTrue("Objectives" in attributes) self.assertTrue("Parameters" in attributes) self.assertTrue("Constraints" in attributes) self.assertTrue("Slots" in attributes) self.assertTrue("Workflow" in attributes) self.assertEqual(attributes["Workflow"]["pathname"], "prob.driver") self.assertEqual(attributes["Workflow"]["type"], "openmdao.lib.drivers.conmindriver.CONMINdriver") self.assertEqual(len(attributes["Workflow"]["workflow"]), 0) self.assertEqual(self.cserver.file_forces_reload("/paraboloid.py"), False) # CREATE PARABOLOID self.cserver.add_component("p", "paraboloid.Paraboloid", "prob", "") self.assertEqual(self.cserver.file_forces_reload("/paraboloid.py"), True) attributes = json.loads(self.cserver.get_attributes("prob.p")) self.assertEqual(attributes["type"], "Paraboloid") self.assertTrue("Inputs" in attributes) inputs = attributes["Inputs"] self.assertEqual(len(inputs), 4) found_x = found_y = False for item in inputs: self.assertTrue("desc" in item) self.assertTrue("name" in item) self.assertTrue("type" in item) # KTM - commented this out, because none of these have units, low # or high attributes. # self.assertTrue('units' in item) # self.assertTrue('high' in item) # self.assertTrue('low' in item) self.assertTrue("valid" in item) self.assertTrue("value" in item) if item["name"] == "x": found_x = True self.assertEqual(item["type"], "float") self.assertEqual(item["desc"], "The variable x") if item["name"] == "y": found_y = True self.assertEqual(item["type"], "float") self.assertEqual(item["desc"], "The variable y") self.assertTrue(found_x) self.assertTrue(found_y) self.assertTrue("Outputs" in attributes) outputs = attributes["Outputs"] self.assertEqual(len(outputs), 4) found_f_xy = False for output in outputs: self.assertTrue("desc" in output) self.assertTrue("name" in output) self.assertTrue("type" in output) # KTM - commented this out, because none of these have units, low # or high attributes. # self.assertTrue('units' in output) # self.assertTrue('high' in output) # self.assertTrue('low' in output) self.assertTrue("valid" in output) self.assertTrue("value" in output) if output["name"] == "f_xy": found_f_xy = True self.assertEqual(output["type"], "float") self.assertEqual(output["desc"], "F(x,y)") self.assertTrue(found_f_xy) # DATAFLOW dataflow = json.loads(self.cserver.get_dataflow("prob")) self.assertEqual(len(dataflow), 5) self.assertTrue("components" in dataflow) components = dataflow["components"] self.assertEqual(len(components), 2) found_p = found_driver = False for comp in components: self.assertTrue("pathname" in comp) self.assertTrue("type" in comp) self.assertTrue("name" in comp) if comp["name"] == "p": found_p = True self.assertEqual(comp["pathname"], "prob.p") self.assertEqual(comp["type"], "Paraboloid") if comp["name"] == "driver": found_driver = True self.assertEqual(comp["pathname"], "prob.driver") self.assertEqual(comp["type"], "CONMINdriver") self.assertTrue(found_p) self.assertTrue(found_driver) self.assertTrue("connections" in dataflow) connections = dataflow["connections"] self.assertEqual(len(connections), 0) self.assertTrue("parameters" in dataflow) parameters = dataflow["parameters"] self.assertEqual(len(parameters), 0) self.assertTrue("constraints" in dataflow) constraints = dataflow["constraints"] self.assertEqual(len(constraints), 0) self.assertTrue("objectives" in dataflow) objectives = dataflow["objectives"] self.assertEqual(len(objectives), 0) # WORKFLOW self.cserver.onecmd('prob.driver.workflow.add("p")') driver_flow = json.loads(self.cserver.get_workflow("prob.driver"))[0] self.assertTrue("pathname" in driver_flow) self.assertTrue("type" in driver_flow) self.assertTrue("workflow" in driver_flow) workflow = driver_flow["workflow"] self.assertEqual(len(workflow), 1) self.assertEqual(workflow[0]["pathname"], "prob.p") self.assertEqual(workflow[0]["type"], "paraboloid.Paraboloid")