def test_getChildAttribteNames(self): casxmi = CasXmiParser() casxmi.setXmiAsFile('tests/testing_data/document1.txt.xmi') for child in casxmi.getRootElement(): self.assertEqual(casxmi.getTag(child),'{http:///uima/cas.ecore}NULL') self.assertEqual(casxmi.getChildIndex(child), 0) for name, value in casxmi.getChildAttributesAsList(child): self.assertEqual(name,'{http://www.omg.org/XMI}id'); self.assertEqual(value,'0'); break
def test_root(self): casxmi = CasXmiParser() casxmi.setXmiAsFile('tests/testing_data/document1.txt.xmi') casxmi1 = CasXmiParser() self.assertEqual(casxmi1.getTag(casxmi.getRootElement()),'{http://www.omg.org/XMI}XMI') self.assertEqual(casxmi1.getLocalname(casxmi.getRootElement()),'XMI') self.assertEqual(casxmi1.getNamespace(casxmi.getRootElement()),'http://www.omg.org/XMI') self.assertEqual(casxmi.getRootTagAsDict(), {'XMI': 'http://www.omg.org/XMI'}) self.assertEqual(casxmi.getRootAttribteNames(), ['{http://www.omg.org/XMI}version']) self.assertEqual(casxmi.getRootAttributesAsDict(),{'{http://www.omg.org/XMI}version': '2.0'}) self.assertEqual(casxmi.getRootAttributesAsList(),[('{http://www.omg.org/XMI}version', '2.0')])