def test_getParamNode(self): paramNode = stgxml.getParamNode(self.flatXMLRoot, "dim") self.assertEqual(paramNode.attrib['name'], "dim") self.assertEqual(paramNode.text, "2") paramNode = stgxml.getParamNode(self.inXMLRoot, "dim") self.assertEqual(paramNode.attrib['name'], "dim") # Whitespace not stripped automatically. self.assertEqual(paramNode.text.strip(), "2") paramNode = stgxml.getParamNode(self.flatXMLRoot, "voodoo") self.assertEqual(paramNode, None)
def test_createNewDataDoc(self): xmlDoc, root = stgxml.createNewStgDataDoc() stgxml.writeParam(root, "testParam", 45) stgxml.writeStgDataDocToFile(xmlDoc, "output/testCreate.xml") xmlDocRead = etree.parse("output/testCreate.xml") rootRead = xmlDocRead.getroot() testParamNode = stgxml.getParamNode(rootRead, "testParam")
def checkStgXMLResultsEnabled(self, inputFilesList, basePath): """Checks that the field comparison has the writing of comparison info to file enabled (returning Bool).""" absInputFiles = stgpath.convertLocalXMLFilesToAbsPaths( inputFilesList, basePath) ffile = stgxml.createFlattenedXML(absInputFiles) xmlDoc = etree.parse(ffile) stgRoot = xmlDoc.getroot() fieldTestDataEl = stgxml.getStructNode(stgRoot, self.stgXMLSpecName) appendNode = stgxml.getParamNode(fieldTestDataEl, "appendToAnalysisFile") appendBool = stgxml.strToBool(appendNode.text) os.remove(ffile) return appendBool
def checkStgXMLResultsEnabled(self, inputFilesList, basePath): """Checks that the field comparison has the writing of comparison info to file enabled (returning Bool).""" absInputFiles = stgpath.convertLocalXMLFilesToAbsPaths(inputFilesList, basePath) ffile=stgxml.createFlattenedXML(absInputFiles) xmlDoc = etree.parse(ffile) stgRoot = xmlDoc.getroot() fieldTestDataEl = stgxml.getStructNode(stgRoot, self.stgXMLSpecName) appendNode = stgxml.getParamNode(fieldTestDataEl, "appendToAnalysisFile") appendBool = stgxml.strToBool(appendNode.text) os.remove(ffile) return appendBool