• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.closeout函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.closeout函数的典型用法代码示例。如果您正苦于以下问题:Python closeout函数的具体用法?Python closeout怎么用?Python closeout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了closeout函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _test_addfiles

def _test_addfiles(browser):
    # Adds multiple files to the project.
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    # Get path to  paraboloid file.
    paraboloidPath = pkg_resources.resource_filename("openmdao.examples.simple", "paraboloid.py")

    # Get path to optimization_unconstrained file.
    optPath = pkg_resources.resource_filename("openmdao.examples.simple", "optimization_unconstrained.py")

    # Add the files
    # would like to test adding multiple files but Selenium doesn't support it
    # workspace_page.add_files(paraboloidPath, optPath)
    workspace_page.add_file(paraboloidPath)
    workspace_page.add_file(optPath)

    # Check to make sure the files were added.
    time.sleep(0.5)
    file_names = workspace_page.get_files()
    expected_file_names = ["optimization_unconstrained.py", "paraboloid.py"]
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'" % (expected_file_names, file_names)
        )

    # Clean up.
    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:RacerXFD,项目名称:OpenMDAO-Framework,代码行数:27,代码来源:test_workspace.py


示例2: _test_editfile

def _test_editfile(browser):
    # Check ability to open code editor by double clicking on file in workspace.
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    # create a couple of files
    file1 = "test1.py"
    workspace_page.new_file(file1)
    file2 = "test2.py"
    workspace_page.new_file(file2)

    # verify file is opened in code editor by double clicking
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.edit_file(file1)
    eq(str(editor_page.get_tab_label()), "/" + file1)

    # verify different file is opened in code editor by double clicking
    browser.switch_to_window(workspace_window)
    editor_page = workspace_page.edit_file(file2)
    eq(str(editor_page.get_tab_label()), "/" + file2)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # verify code editor can be re-opened by double clicking on file
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.edit_file(file1)
    eq(str(editor_page.get_tab_label()), "/" + file1)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:Kenneth-T-Moore,项目名称:OpenMDAO-Framework,代码行数:35,代码来源:test_codeeditor.py


示例3: _test_drop_on_grid

def _test_drop_on_grid(browser):
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    #other tests also need to put an assembly on the grid, so put in seperate method
    put_assembly_on_grid(workspace_page)

    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:Kenneth-T-Moore,项目名称:OpenMDAO-Framework,代码行数:7,代码来源:test_dragdrop.py


示例4: _test_objtree

def _test_objtree(browser):
    # Toggles maxmimize/minimize button on assemblies.
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    # Add maxmin.py to project
    file_path = pkg_resources.resource_filename("openmdao.gui.test.functional", "maxmin.py")
    workspace_page.add_file(file_path)

    # Add MaxMin to 'top'.
    workspace_page.show_dataflow("top")
    workspace_page.add_library_item_to_dataflow("maxmin.MaxMin", "maxmin")

    # Maximize 'top' and 'top.maxmin'
    visible = workspace_page.get_objects_attribute("path", True)
    eq(visible, ["top"])
    workspace_page.expand_object("top")
    time.sleep(0.5)
    visible = workspace_page.get_objects_attribute("path", True)
    eq(visible, ["top", "top.driver", "top.maxmin"])
    workspace_page.expand_object("top.maxmin")
    time.sleep(0.5)
    visible = workspace_page.get_objects_attribute("path", True)
    eq(visible, ["top", "top.driver", "top.maxmin", "top.maxmin.driver", "top.maxmin.sub"])

    workspace_page.add_library_item_to_dataflow("maxmin.MaxMin", "maxmin2")
    visible = workspace_page.get_objects_attribute("path", True)
    eq(visible, ["top", "top.driver", "top.maxmin", "top.maxmin.driver", "top.maxmin.sub", "top.maxmin2"])

    # Clean up.
    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:RacerXFD,项目名称:OpenMDAO-Framework,代码行数:30,代码来源:test_workspace.py


示例5: _test_remove_tla

def _test_remove_tla(browser):
    # verify that adding, removing, and adding a top level assembly works.
    project_dict, workspace_page = startup(browser)
    eq(len(workspace_page.get_dataflow_figures()), 1)

    # create a top assembly and check number of figures
    workspace_page.add_library_item_to_dataflow(
        'openmdao.main.assembly.Assembly', 'top1')
    eq(len(workspace_page.get_dataflow_figures()), 3)

    # add component to top assembly and check for additional figure
    workspace_page.add_library_item_to_dataflow(
                    'openmdao.lib.components.external_code.ExternalCode', 'ext',
                    target_name='top1')
    eq(len(workspace_page.get_dataflow_figures()), 4)

    # remove top and check that it and it's child figures are gone
    top = workspace_page.get_dataflow_figure('top1')
    top.remove()
    eq(len(workspace_page.get_dataflow_figures()), 1)

    # add a new top, verify on screen.
    workspace_page.add_library_item_to_dataflow(
        'openmdao.main.assembly.Assembly', 'top2')
    eq(len(workspace_page.get_dataflow_figures()), 3)

    # clean up
    closeout(project_dict, workspace_page)
开发者ID:hitej,项目名称:meta-core,代码行数:28,代码来源:test_dataflow.py


示例6: _test_crlf

def _test_crlf(browser):
    # Test ability to handle a file with Windows-style CR/LF line terminations
    project_dict, workspace_page = startup(browser)

    # add a Windows notepad generated python file
    filename = 'notepad.py'
    filepath = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                               'files/notepad.py')
    workspace_page.add_file(filepath)

    # open file in code editor
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.edit_file(filename)
    eq(str(editor_page.get_tab_label()), '/' + filename)

    # add a comment and save
    comment = '# a comment'
    editor_page.append_text_to_file(comment)
    editor_page.save_document()

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # re-open file and verify comment was successfully added
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.edit_file(filename)
    assert editor_page.get_code().endswith(comment)

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Clean up.
    closeout(project_dict, workspace_page)
开发者ID:hitej,项目名称:meta-core,代码行数:35,代码来源:test_codeeditor.py


示例7: _test_remove

def _test_remove(browser):
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    # Show assembly information.
    workspace_page.select_object("top")
    top = workspace_page.get_dataflow_figure("top", "")
    editor = top.editor_page(double_click=False)
    editor.move(-100, 100)  # Move it away from context menu.
    connections = top.connections_page()
    properties = top.properties_page()

    eq(editor.is_visible, True)
    eq(connections.is_visible, True)
    eq(properties.is_visible, True)

    # Remove component.
    top.remove()

    time.sleep(1)
    eq(editor.is_visible, False)
    eq(connections.is_visible, False)
    eq(properties.is_visible, False)

    # Clean up.
    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:RacerXFD,项目名称:OpenMDAO-Framework,代码行数:25,代码来源:test_workspace.py


示例8: _test_remove

def _test_remove(browser):
    project_dict, workspace_page = startup(browser)

    # Show assembly information.
    top = workspace_page.add_library_item_to_dataflow('openmdao.main.assembly.Assembly', 'top')
    workspace_page.select_object('top')
    workspace_page.show_dataflow('top')
    workspace_page.hide_left()

    # open various views on the top assembly
    top = workspace_page.get_dataflow_figure('top', '')
    editor = top.editor_page(double_click=False)
    editor.move(100, 200)
    connections = top.connections_page()
    properties = top.properties_page()

    eq(editor.is_visible, True)
    eq(connections.is_visible, True)
    eq(properties.is_visible, True)

    # Remove component.
    top.remove()

    # make sure all the views on the top assembly go away
    time.sleep(1)
    eq(editor.is_visible, False)
    eq(connections.is_visible, False)
    eq(properties.is_visible, False)

    # Clean up.
    closeout(project_dict, workspace_page)
开发者ID:TwanvdBorgh,项目名称:OpenMDAO-Framework,代码行数:31,代码来源:test_workspace.py


示例9: _test_ordering

def _test_ordering(browser):
    # Verify that adding parameter to driver moves it ahead of target.
    project_dict, workspace_page = startup(browser)

    workspace_page.add_library_item_to_dataflow("openmdao.main.assembly.Assembly", "top")
    # Add ExternalCode and SLSQP.
    workspace_page.show_dataflow("top")
    ext = workspace_page.add_library_item_to_dataflow(
        "openmdao.lib.components.external_code.ExternalCode", "ext", prefix="top"
    )
    opt = workspace_page.add_library_item_to_dataflow(
        "openmdao.lib.drivers.slsqpdriver.SLSQPdriver", "opt", prefix="top"
    )

    # Add parameter to SLSQP.
    editor = opt.editor_page(base_type="Driver")
    editor("parameters_tab").click()
    editor.move(-100, -100)
    dialog = editor.new_parameter()
    dialog.target = "ext.timeout"
    dialog.low = "0"
    dialog.high = "1"
    dialog.name = "tmo"
    dialog("ok").click()

    # Check that SLSQP is above and to the left of ExternalCode
    ext = workspace_page.get_dataflow_figure("ext", "top")
    opt = workspace_page.get_dataflow_figure("opt", "top")
    assert ext.coords[0] > opt.coords[0]
    assert ext.coords[1] > opt.coords[1]

    # Clean up.
    editor.close()
    closeout(project_dict, workspace_page)
开发者ID:TwanvdBorgh,项目名称:OpenMDAO-Framework,代码行数:34,代码来源:test_dataflow.py


示例10: _test_component_tree

def _test_component_tree(browser):
    project_dict, workspace_page = startup(browser)

    workspace_page.select_objects_view('Components')

    # Add maxmin.py to project
    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                'files/maxmin.py')
    workspace_page.add_file(file_path)

    # Add MaxMin to 'top'.
    workspace_page.add_library_item_to_dataflow('openmdao.main.assembly.Assembly', 'top')
    workspace_page.show_dataflow('top')
    workspace_page.add_library_item_to_dataflow('maxmin.MaxMin', 'maxmin')

    # Maximize 'top' and 'top.maxmin'
    visible = workspace_page.get_objects_attribute('path', True)
    eq(visible, ['top'])
    workspace_page.expand_object('top')
    time.sleep(0.5)
    visible = workspace_page.get_objects_attribute('path', True)
    eq(visible, ['top', 'top.driver', 'top.maxmin'])
    workspace_page.expand_object('top.maxmin')
    time.sleep(0.5)
    visible = workspace_page.get_objects_attribute('path', True)
    eq(visible, ['top', 'top.driver', 'top.maxmin',
                 'top.maxmin.driver', 'top.maxmin.sub'])

    workspace_page.add_library_item_to_dataflow('maxmin.MaxMin', 'maxmin2')
    visible = workspace_page.get_objects_attribute('path', True)
    eq(visible, ['top', 'top.driver', 'top.maxmin',
                 'top.maxmin.driver', 'top.maxmin.sub', 'top.maxmin2'])

    # Clean up.
    closeout(project_dict, workspace_page)
开发者ID:TwanvdBorgh,项目名称:OpenMDAO-Framework,代码行数:35,代码来源:test_workspace.py


示例11: _test_parameter_auto

def _test_parameter_auto(browser):
    # Test auto-filling the min and max for a parameter.
    project_dict, workspace_page = startup(browser)

    file_path = pkg_resources.resource_filename('openmdao.gui.test.functional',
                                                'files/connect.py')
    workspace_page.add_file(file_path)

    workspace_page.add_library_item_to_dataflow('connect.Conn_Assy',
                                                'top')
    # Add parameter to driver.
    driver = workspace_page.get_dataflow_figure('driver', 'top')
    editor = driver.editor_page(base_type='Driver')
    editor('parameters_tab').click()
    dialog = editor.new_parameter()
    dialog.target = 'comp.x'
    dialog('ok').click()

    parameters = editor.get_parameters()
    expected = [['', 'comp.x', '0', '299', '1', '0', '', 'comp.x']]
    eq(len(parameters.value), len(expected))
    for i, row in enumerate(parameters.value):
        eq(row, expected[i])

    editor.close()

    closeout(project_dict, workspace_page)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:27,代码来源:test_workflow.py


示例12: _test_loading_docs

def _test_loading_docs(browser):
    project_dict, workspace_page = startup(browser)

    # Check that the docs are viewable
    workspace_page('help_menu').click()
    time.sleep(0.5)
    eq(workspace_page('doc_button').get_attribute('id'), 'help-doc')

    workspace_window = browser.current_window_handle
    current_windows = set(browser.window_handles)
    workspace_page('doc_button').click()
    new_windows = set(browser.window_handles) - current_windows
    docs_window = list(new_windows)[0]
    browser.switch_to_window(docs_window)
    time.sleep(0.5)
    eq("OpenMDAO User Guide" in browser.title, True)
    eq("OpenMDAO Documentation" in browser.title, True)

    browser.close()
    browser.switch_to_window(workspace_window)
    workspace_page.show_library()
    browser.switch_to_window(workspace_page.view_library_item_docs("openmdao.main.assembly.Assembly"))

    # Just check to see if a Traceback 404 message was sent.
    try:
        browser.find_element((By.XPATH, "/html/head/body/pre[1]"))
        assert False
    except:
        pass
    browser.close()
    browser.switch_to_window(workspace_window)
    closeout(project_dict, workspace_page)
开发者ID:TwanvdBorgh,项目名称:OpenMDAO-Framework,代码行数:32,代码来源:test_workspace.py


示例13: _test_drop_on_component_editor_grid

def _test_drop_on_component_editor_grid(browser):
    project_dict, workspace_page = startup(browser)

    workspace_page.add_library_item_to_dataflow('openmdao.main.assembly.Assembly', 'top')
    top = workspace_page.get_dataflow_figure('top', '')

    workspace_page.set_library_filter('Assembly')   # put Assembly at top of lib
    assembly = workspace_page.find_library_button('Assembly')

    editor = top.editor_page(double_click=False, base_type='Assembly')
    editor.show_dataflow()

    editor_top = workspace_page.get_dataflow_fig_in_globals('top')

    # sort through these to find the correct 'top'

    chain = ActionChains(browser)
    chain.click_and_hold(assembly)
    chain.move_to_element(editor_top('header').find_element_by_xpath("..")).perform()
    chain.move_by_offset(200, 1).perform()
    chain.release(None).perform()

    # don't bother checking to see if it appeared,
    # the UI box will appear and screw the test if it did

    closeout(project_dict, workspace_page)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:26,代码来源:test_dragdrop.py


示例14: _test_update

def _test_update(browser):
    # Adding a parameter to a driver should update the driver's workflow.
    project_dict, workspace_page = startup(browser)

    # Create model with CONMIN and ExecComp.
    workspace_page.add_library_item_to_dataflow('openmdao.main.assembly.Assembly', 'top')
    workspace_page.show_dataflow('top')
    workspace_page.replace_driver('top', 'CONMINdriver')
    workspace_page.add_library_item_to_dataflow(
        'openmdao.test.execcomp.ExecComp', 'exe', args=["('z = x * y',)"])

    # Add parameter to CONMIN.
    driver = workspace_page.get_dataflow_figure('driver', 'top')
    editor = driver.editor_page(base_type='Driver')
    editor('parameters_tab').click()
    dialog = editor.new_parameter()
    dialog.target = 'exe.x'
    dialog.low = '-1'
    dialog.high = '1'
    dialog('ok').click()
    editor.close()

    # Verify workflow contains ExecComp.
    workspace_page('workflow_tab').click()
    eq(len(workspace_page.get_workflow_figures()), 1)
    eq(len(workspace_page.get_workflow_component_figures()), 2)

    # Clean up.
    closeout(project_dict, workspace_page)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:29,代码来源:test_workflow.py


示例15: _test_remove

def _test_remove(browser):
    #projects_page, project_info_page, project_dict, workspace_page = startup(browser)
    project_dict, workspace_page = startup(browser)

    # Show assembly information.
    # Lots of futzing here to handle short screens (EC2 Windows).
    workspace_page.select_object('top')
    workspace_page.show_dataflow('top')
    workspace_page.hide_left()
    top = workspace_page.get_dataflow_figure('top', '')
    editor = top.editor_page(double_click=False)
    editor.move(100, 200)
    connections = top.connections_page()
    properties = top.properties_page()

    eq(editor.is_visible, True)
    eq(connections.is_visible, True)
    eq(properties.is_visible, True)

    # Remove component.
    top.remove()

    time.sleep(1)
    eq(editor.is_visible, False)
    eq(connections.is_visible, False)
    eq(properties.is_visible, False)

    # Clean up.
    # closeout(projects_page, project_info_page, project_dict, workspace_page)
    closeout(project_dict, workspace_page)
开发者ID:akhi28,项目名称:OpenMDAO-Framework,代码行数:30,代码来源:test_workspace.py


示例16: _test_display_differentiator

def _test_display_differentiator(browser):
    # Verify that we can display a differentiator (based on Container).
    project_dict, workspace_page = startup(browser)
    eq(len(workspace_page.get_dataflow_figures()), 1)

    # Create assembly with an SLSQPdriver.
    workspace_page.add_library_item_to_dataflow(
        'openmdao.main.assembly.Assembly', 'top')
    workspace_page.show_dataflow('top')
    workspace_page.replace_driver('top', 'SLSQPdriver')
    driver = workspace_page.get_dataflow_figure('driver', 'top')
    editor = driver.editor_page(base_type='Driver')
    editor.move(-400, 0)

    # Display & verify differentiator.
    editor.show_slots()
    diff = find_slot_figure(workspace_page, 'differentiator',
                            prefix='top.driver')
    diff_editor = diff.edit()
    inputs = diff_editor.get_inputs()
    expected = [
        ['', 'default_stepsize', '0.000001', '',
         'Default finite difference step size.'],
        ['', 'form', 'central', '',
         'Finite difference form (central, forward, backward).'],
    ]
    for i, row in enumerate(inputs.value):
        eq(row, expected[i])

    # Clean up.
    diff_editor.close()
    editor.close()
    closeout(project_dict, workspace_page)
开发者ID:hitej,项目名称:meta-core,代码行数:33,代码来源:test_dataflow.py


示例17: _test_ordering

def _test_ordering(browser):
    # Verify that adding parameter to driver moves it ahead of target.
    project_dict, workspace_page = startup(browser)

    # Add ExternalCode and SLSQP.
    workspace_page.show_dataflow('top')
    ext = workspace_page.add_library_item_to_dataflow(
              'openmdao.lib.components.external_code.ExternalCode', 'ext',
              prefix='top')
    opt = workspace_page.add_library_item_to_dataflow(
              'openmdao.lib.drivers.slsqpdriver.SLSQPdriver', 'opt',
              prefix='top')

    # Check that ExternalCode is before SLSQP.
    assert ext.coords[0] < opt.coords[0]

    # Add parameter to SLSQP.
    editor = opt.editor_page(base_type='Driver')
    editor('parameters_tab').click()
    dialog = editor.new_parameter()
    dialog.target = 'ext.timeout'
    dialog.low = '0'
    dialog.high = '1'
    dialog.name = 'tmo'
    dialog('ok').click()

    # Check that SLSQP is now ahead of ExternalCode.
    ext = workspace_page.get_dataflow_figure('ext', 'top')
    opt = workspace_page.get_dataflow_figure('opt', 'top')
    assert ext.coords[0] > opt.coords[0]

    # Clean up.
    closeout(project_dict, workspace_page)
开发者ID:akhi28,项目名称:OpenMDAO-Framework,代码行数:33,代码来源:test_dataflow.py


示例18: _test_newfile

def _test_newfile(browser):
    # Creates a file in the GUI.
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    # Open code editor.
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.open_editor()

    # test the 'ok' and 'cancel' buttons on the new file dialog
    dlg = editor_page.new_file_dialog()
    dlg.set_text("ok_file1")
    dlg.click_ok()
    NotifierPage.wait(editor_page)

    dlg = editor_page.new_file_dialog()
    dlg.set_text("cancel_file")
    dlg.click_cancel()

    dlg = editor_page.new_file_dialog()
    dlg.set_text("ok_file2")
    dlg.click_ok()
    NotifierPage.wait(editor_page)

    file_names = editor_page.get_files()
    expected_file_names = ["ok_file1", "ok_file2"]
    if sorted(file_names) != sorted(expected_file_names):
        raise TestCase.failureException(
            "Expected file names, '%s', should match existing file names, '%s'" % (expected_file_names, file_names)
        )

    # Create the file (code editor automatically indents).
    editor_page.new_file(
        "plane.py",
        """
from openmdao.main.api import Component
from openmdao.lib.datatypes.api import Float

# lines will be auto-indented by ace editor
class Plane(Component):

x1 = Float(0.0, iotype='in')
x2 = Float(0.0, iotype='in')
x3 = Float(0.0, iotype='in')

f_x = Float(0.0, iotype='out')
""",
    )

    # Back to workspace.
    browser.close()
    browser.switch_to_window(workspace_window)

    # Drag over Plane.
    workspace_page.show_dataflow("top")
    workspace_page.set_library_filter("In Project")
    workspace_page.add_library_item_to_dataflow("plane.Plane", "plane")

    # Clean up.
    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:Kenneth-T-Moore,项目名称:OpenMDAO-Framework,代码行数:59,代码来源:test_codeeditor.py


示例19: _test_slots

def _test_slots(browser):
    project_dict, workspace_page = startup(browser)

    editor, metamodel, caseiter, caserec, comp, meta_name = slot_reset(workspace_page)

    execcomp = workspace_page.find_library_button('ExecComp')

    # drop ExecComp onto MetaModel 'recorder' slot. This should fail.
    workspace_page.drag_and_drop(execcomp, caserec, False, 'Component')
    time.sleep(1.0)  # give it a second to update the figure
    caserec = find_slot_figure(workspace_page, 'recorder', prefix=meta_name)
    eq(False, caserec.filled,
        "Component dropped into CaseRecorder (should not have)")

    # drop ExecComp onto the MetaModel 'model' slot. This should succeed.
    comp = find_slot_figure(workspace_page, 'model', prefix=meta_name)
    workspace_page.fill_slot_from_library(comp, 'ExecComp')

    time.sleep(1.0)  # give it a second to update the figure
    comp = find_slot_figure(workspace_page, 'model', prefix=meta_name)
    eq(True, comp.filled,
        "Component did not drop into Component slot")

    # remove ExecComp from the MetaModel 'model' slot. This should succeed.
    comp.remove()
    time.sleep(1.0)  # give it a second to update the figure
    comp = find_slot_figure(workspace_page, 'model', prefix=meta_name)
    eq(False, comp.filled,
        "Component slot was not emptied")

    #for the future:
    """
    # get the objects we need for the test
    # setup a data structure explaining which things can be dropped where
    # element, dropOnCaseIter, dropOnCaseRec, dropOnComp
    dropdata = [('CSVCaseIterator', True, False, False),\
                 ('CSVCaseRecorder', False, True, False),\
                 ('ExecComp', False, False, True),\
                 ('Assembly', False, False, True)]

    drop_elements = [(workspace_page.find_library_button(ele[0]), ele[1], ele[2], ele[3]) for ele in dropdata]

    #now loop through each dropable item, and see what happens when it lands on the target
    for ele in drop_elements:
        #drop on caseiter
        drag_and_drop(browser, ele[0].element, caseiter, ele[1], 'CaseIterator')
    #TODO: REFRESH THE SLOTS, CHECK THEIR FONT COLOR
        #drop on caserec
        drag_and_drop(browser, ele[0].element, caserec, ele[2], 'CaseRecorder')
    #TODO: REFRESH THE SLOTS, CHECK THEIR FONT COLOR
        #drop on comp
        drag_and_drop(browser, ele[0].element, comp, ele[3], 'Component')
    #TODO: REFRESH THE SLOTS, CHECK THEIR FONT COLOR

        editor, metamodel, caseiter, caserec, comp = slot_reset(workspace_page, editor, metamodel, True)
    """

    editor.close()
    closeout(project_dict, workspace_page)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:59,代码来源:test_slots.py


示例20: _test_console_errors

def _test_console_errors(browser):
    projects_page, project_info_page, project_dict, workspace_page = startup(browser)

    # Set input to illegal value.
    top = workspace_page.get_dataflow_figure("driver", "top")
    editor = top.editor_page(double_click=False, base_type="Driver")
    inputs = editor.get_inputs()
    inputs[2][2] = "42"  # printvars
    message = NotifierPage.wait(editor)
    eq(
        message,
        "TraitError: The 'printvars' trait of a "
        "Run_Once instance must be a list of items "
        "which are a legal value, but a value of 42 "
        "<type 'int'> was specified.",
    )
    editor.close()

    # Attempt to save file with syntax error.
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.open_editor()
    editor_page.new_file(
        "bug.py",
        """
from openmdao.main.api import Component
class Bug(Component):
def execute(self)
    pass
""",
        check=False,
    )

    message = NotifierPage.wait(editor_page, base_id="file-error")
    eq(message, "invalid syntax (bug.py, line 6)")

    browser.close()
    browser.switch_to_window(workspace_window)

    # Load file with instantiation error.
    workspace_window = browser.current_window_handle
    editor_page = workspace_page.open_editor()
    editor_page.new_file(
        "bug2.py",
        """
from openmdao.main.api import Component
class Bug2(Component):
def __init__(self):
raise RuntimeError("__init__ failed")
""",
    )
    browser.close()
    browser.switch_to_window(workspace_window)
    workspace_page.add_library_item_to_dataflow("bug2.Bug2", "bug", check=False)
    message = NotifierPage.wait(workspace_page)
    eq(message, "NameError: unable to create object of type 'bug2.Bug2': __init__ failed")

    # Clean up.
    closeout(projects_page, project_info_page, project_dict, workspace_page)
开发者ID:RacerXFD,项目名称:OpenMDAO-Framework,代码行数:58,代码来源:test_workspace.py



注:本文中的util.closeout函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.cmd函数代码示例发布时间:2022-05-27
下一篇:
Python util.clip函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap