当前位置: 首页>>代码示例>>Python>>正文


Python ExecutableInfo.path方法代码示例

本文整理汇总了Python中peacock.Input.ExecutableInfo.ExecutableInfo.path方法的典型用法代码示例。如果您正苦于以下问题:Python ExecutableInfo.path方法的具体用法?Python ExecutableInfo.path怎么用?Python ExecutableInfo.path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在peacock.Input.ExecutableInfo.ExecutableInfo的用法示例。


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

示例1: testIncompatible

# 需要导入模块: from peacock.Input.ExecutableInfo import ExecutableInfo [as 别名]
# 或者: from peacock.Input.ExecutableInfo.ExecutableInfo import path [as 别名]
    def testIncompatible(self):
        t = InputTree(ExecutableInfo())
        app_info = ExecutableInfo()
        # The original tree wasn't set, any new changes
        # are not incompatible
        self.assertFalse(t.incompatibleChanges(app_info))
        app_info.json_data = {"bad_block": None}
        self.assertFalse(t.incompatibleChanges(app_info))

        # Current tree is good, new one is not
        app_info.json_data = None
        t = self.createTree(input_file=self.simple_diffusion)
        self.assertTrue(t.incompatibleChanges(app_info))
        app_info.json_data = {"bad_block": None}
        self.assertFalse(app_info.valid())
        self.assertTrue(t.incompatibleChanges(app_info))
        app_info.path ="foo"
        self.assertTrue(app_info.valid())
        self.assertTrue(t.incompatibleChanges(app_info)) # No / which causes an exception
        app_info.path_map = t.app_info.path_map.copy()
        self.assertFalse(t.incompatibleChanges(app_info)) # Should be the same, no problems

        # Simulate removing /BCs/*/<types>/DirichletBC/boundary
        # This should be fine since users can have extra parameters
        # in their input file
        root = app_info.path_map["/"]
        bcs = root.children["BCs"]
        pname = "boundary"
        tmp = bcs.star_node.types["DirichletBC"]
        p = tmp.parameters[pname]
        p.user_added = True
        tmp.removeUserParam(pname)
        p = bcs.star_node.parameters[pname]
        p.user_added = True
        bcs.star_node.removeUserParam(pname)
        tmp_tree = InputTree(app_info)

        tmp_tree.setInputFileData(t.getInputFileString())
        left = tmp_tree.getBlockInfo("/BCs/left")
        self.assertTrue(left.user_added)
        boundary = left.parameters["boundary"]
        self.assertTrue(boundary.user_added)
        self.assertTrue(boundary.set_in_input_file)
        self.assertFalse(t.incompatibleChanges(app_info))

        # Simulate removing /BCs syntax
        # This should cause a problem
        del app_info.path_map["/BCs"]
        root.children_list.remove("BCs")
        del root.children["BCs"]
        self.assertTrue(t.incompatibleChanges(app_info)) # Errors when reading the input file
开发者ID:zachmprince,项目名称:moose,代码行数:53,代码来源:test_InputTree.py


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