def test_findMatches_guaranteed_match(self): s = "<xml><THU><Team></Team></THU><THU></THU></xml>" a = fromstring(s) pattern = XML.getPattern(a) patternChildren = 0 patternChildren = XML.countChildren(pattern) XML.matches = 0 XML.findMatches(a, pattern, patternChildren) self.assertTrue(XML.matches == 0)
def test_findMatches(self): s = "<xml><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></xml>" a = fromstring(s) pattern = XML.getPattern(a) patternChildren = 0 patternChildren = XML.countChildren(pattern) XML.locations = [] XML.locations = XML.findMatches(a, pattern, patternChildren) self.assertTrue(XML.locations == []) #function only works in conjunction with the count function