示例#1
0
 def newTree(self,root,pivotParam=None):
   """
     Sets up a new internal tree.
     @ In, root, string, name of root node
     @ In, pivotParam, string, unused (for consistency with dynamic method)
     @ Out, None
   """
   self.tree = xmlUtils.newTree(root,attrib={'type':'Static'})
示例#2
0
 def newTree(self, root, pivotParam=None):
     """
   Sets up a new internal tree.
   @ In, root, string, name of root node
   @ In, pivotParam, string, name of time-like parameter
   @ Out, None
 """
     self.tree = xmlUtils.newTree(root, attrib={'type': 'Dynamic'})
     if pivotParam is None:
         self.raiseAnError(
             RuntimeError,
             'newTree argument pivotParam is None but output is in dynamic mode!'
         )
     self.pivotParam = pivotParam
     self.pivotNodes = []
示例#3
0
    print(
        'ERROR: Test of "newNode" failed!  Did not find attribute "atr2" in keys:',
        node.attrib.keys())
else:
    if node.attrib['atr2'] != 'atr2_text':
        okay = False
        print(
            'ERROR: Test of "newNode" failed! Attribute "atr2" should have been "atr2_text" but was',
            node.attrib['atr2'])
if okay:
    results['pass'] += 1
else:
    results['fail'] += 1

# test newTree
tree = xmlUtils.newTree('newroot')
okay = True
if type(tree) != treeType:
    okay = False
    print(
        'ERROR: Test of "newTree" failed!  Returned tree was not xml.etree.ElementTree.ElementTree, instead was',
        type(tree))
elif tree.getroot().tag != 'newroot':
    okay = False
    print(
        'ERROR: Test of "newTree" failed!  Root of new tree should be "newroot" but instead got',
        tree.getroot().tag)
if okay:
    results['pass'] += 1
else:
    results['fail'] += 1