本文整理匯總了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