def test_compareNode_3 (self) : xml = ET.fromstring ( "<root><THU><Team><ACRush></ACRush><Jelly></Jelly><Cooly></Cooly></Team><JiaJia><Team><Ahyangyi></Ahyangyi><Dragon></Dragon><Cooly><Amber></Amber></Cooly></Team></JiaJia></THU><Team><Cooly></Cooly></Team></root>" ) root = xml [ 0 ] search = xml [ 1 ] xml.remove ( xml [ 1 ] ) foundNodes = xml.findall ( ".//" + search.tag ) equal1 = compareNode ( foundNodes [ 0 ], search ) equal2 = compareNode ( foundNodes [ 1 ], search ) self.assert_(equal1 == True) self.assert_(equal2 == True)
def test_compareNode_2 (self) : xml = ET.fromstring ( "<root><THU></THU><THU><a></a></THU></root>" ) root = xml [ 0 ] search = xml [ 1 ] xml.remove ( xml [ 1 ] ) foundNodes = xml.findall ( ".//" + search.tag ) equal = compareNode ( foundNodes [ 0 ], search ) self.assert_(equal == False)