def test_getListNode(self): listNode = stgxml.getListNode(self.flatXMLRoot, "FieldVariablesToCheckpoint") self.assertEqual(listNode.attrib['name'], "FieldVariablesToCheckpoint") self.assertEqual(listNode.text.strip(), "") self.assertEqual(len(listNode), 3) listNode = stgxml.getListNode(self.flatXMLRoot, "voodoo") self.assertEqual(listNode, None) # Test for the plugins and imports lists, in both listNode = stgxml.getListNode(self.inXMLRoot, "plugins") self.assertEqual(listNode.attrib['name'], "plugins") self.assertEqual(listNode.text.strip(), "") self.assertEqual(len(listNode), 2) listNode = stgxml.getListNode(self.flatXMLRoot, "plugins") self.assertEqual(listNode.tag, stgxml.addNsPrefix("plugins")) self.assertEqual(listNode.text.strip(), "") # This is a merged list, containing 3 plugin definitions self.assertEqual(len(listNode), 3) listNode = stgxml.getListNode(self.inXMLRoot, "import") self.assertEqual(listNode.attrib['name'], "import") self.assertEqual(listNode.text.strip(), "") self.assertEqual(len(listNode), 1) listNode = stgxml.getListNode(self.flatXMLRoot, "import") self.assertEqual(listNode.tag, stgxml.addNsPrefix("import")) self.assertEqual(listNode.text.strip(), "") self.assertEqual(len(listNode), 1)
def test_getStructNode(self): structNode = stgxml.getStructNode(self.flatXMLRoot, "velocityICs") self.assertEqual(structNode.attrib['name'], "velocityICs") self.assertEqual(structNode.text.strip(), "") self.assertEqual(len(structNode), 2) structNode = stgxml.getStructNode(self.inXMLRoot, "velocityICs") self.assertEqual(structNode.attrib['name'], "velocityICs") self.assertEqual(structNode.text.strip(), "") self.assertEqual(len(structNode), 2) structNode = stgxml.getStructNode(self.flatXMLRoot, "voodoo") self.assertEqual(structNode, None) # Test for the components struct, in both structNode = stgxml.getStructNode(self.inXMLRoot, "components") self.assertEqual(structNode.attrib['name'], "components") self.assertEqual(structNode.text.strip(), "") structNode = stgxml.getStructNode(self.flatXMLRoot, "components") self.assertEqual(structNode.tag, stgxml.addNsPrefix("components")) self.assertEqual(structNode.text.strip(), "")