Beispiel #1
0
    def test_findpath_3 (self) :
        s = "<xml>\n<THU>\n<Team></Team>\n<Cooly></Cooly>\n</THU>\n<Team><Cooly><Blah></Blah></Cooly></Team>\n</xml>"
        root = ET.fromstring(s)

        # Haystack is first child of <xml> root
        haystack = list(root)[0]

        # Needle is seconde child of <xml> root
        needle = list(root)[1]

        o = findpath(haystack, ".")
        self.assert_(o == "./Team/../Cooly")   
Beispiel #2
0
    def test_findpath_2 (self) :
        s = "<xml>\n<THU>\n<Team>\n<Cooly></Cooly>\n<JiaJia></JiaJia>\n</Team>\n<ACRush></ACRush>\n</THU>\n<Team><Cooly></Cooly><JiaJia></JiaJia></Team>\n</xml>"
        root = ET.fromstring(s)

        # Haystack is first child of <xml> root
        haystack = list(root)[0]

        # Needle is seconde child of <xml> root
        needle = list(root)[1]

        o = findpath(needle, ".")
        self.assert_(o == "./Cooly/../JiaJia")