def test_xmlQueryToRegex_text (self) : query = "<T> <C> test </C> more text <D> even more text </D> </T>" queryroot = et.fromstring(query) result = xmlQueryToRegex(queryroot) self.assert_(result == ".//T/C/../D/..")
def test_xmlQueryToRegex_1 (self) : query = "<T></T>" queryroot = et.fromstring(query) result = xmlQueryToRegex(queryroot) self.assert_(result == ".//T")
def test_xmlQueryToRegex_4 (self) : query = "<T> <C> <D> </D> </C> <J> </J> </T>" queryroot = et.fromstring(query) result = xmlQueryToRegex(queryroot) self.assert_(result == ".//T/C/D/../../J/..")
def test_xmlEval_sphere (self) : sourceRoot = et.fromstring(xml_child_source) queryRoot = et.fromstring(xml_child_query) result = xmlEval(sourceRoot, queryRoot) self.assert_(result == [2, 2, 7])
def test_xmlEval_mixed (self) : sourceRoot = et.fromstring(xml_child_source) queryRoot = et.fromstring("<Team><Cooly><Amber></Amber></Cooly><Dragon></Dragon></Team>") result = xmlEval(sourceRoot, queryRoot) self.assert_(result == [1, 7])
def test_xmlQueryToRegex_text(self): query = "<T> <C> test </C> more text <D> even more text </D> </T>" queryroot = et.fromstring(query) result = xmlQueryToRegex(queryroot) self.assert_(result == ".//T/C/../D/..")
def test_xmlEval_easy (self) : sourceRoot = et.fromstring(xml_easy) queryRoot = et.fromstring("<Team></Team>") result = xmlEval(sourceRoot, queryRoot) self.assert_(result == [1, 1])
def test_xmlQueryToRegex_4(self): query = "<T> <C> <D> </D> </C> <J> </J> </T>" queryroot = et.fromstring(query) result = xmlQueryToRegex(queryroot) self.assert_(result == ".//T/C/D/../../J/..")
def test_xmlQueryToRegex_1(self): query = "<T></T>" queryroot = et.fromstring(query) result = xmlQueryToRegex(queryroot) self.assert_(result == ".//T")
def test_xmlEval_mixed(self): sourceRoot = et.fromstring(xml_child_source) queryRoot = et.fromstring( "<Team><Cooly><Amber></Amber></Cooly><Dragon></Dragon></Team>") result = xmlEval(sourceRoot, queryRoot) self.assert_(result == [1, 7])
def test_xmlEval_sphere(self): sourceRoot = et.fromstring(xml_child_source) queryRoot = et.fromstring(xml_child_query) result = xmlEval(sourceRoot, queryRoot) self.assert_(result == [2, 2, 7])
def test_xmlEval_easy(self): sourceRoot = et.fromstring(xml_easy) queryRoot = et.fromstring("<Team></Team>") result = xmlEval(sourceRoot, queryRoot) self.assert_(result == [1, 1])