Esempio n. 1
0
 def test_read_2(self) :
     r = io.StringIO("<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>")
     b, c = XML.xml_read(r)
     self.assertTrue(tostring(b, encoding = 'unicode') == tostring(fromstring("<THU><Team><ACRush></ACRush><Jelly></Jelly><Cooly></Cooly></Team><JiaJia><Team><Ahyangyi></Ahyangyi><Dragon></Dragon><Cooly><Amber></Amber></Cooly></Team></JiaJia></THU>"),encoding='unicode'))
     self.assertTrue(tostring(c, encoding = 'unicode') == tostring(fromstring("<Team><Cooly></Cooly></Team>"),encoding='unicode'))
Esempio n. 2
0
 def test_read_3(self) :
     r = io.StringIO("<red><green><blue></blue><yellow></yellow></green></red><red><green></green></red>")
     b, c = XML.xml_read(r)
     self.assertTrue(tostring(b, encoding = 'unicode') == tostring(fromstring("<red><green><blue></blue><yellow></yellow></green></red>"),encoding = 'unicode'))
     self.assertTrue(tostring(c, encoding = 'unicode') == tostring(fromstring("<red><green></green></red>"),encoding = 'unicode'))
Esempio n. 3
0
 def test_read_1 (self) :
     r = io.StringIO("<cat><dog><bird><rat></rat></bird><chicken><goose></goose></chicken><egg></egg></dog><toy><car><race></race></car><computer><keyboard></keyboard></computer><monitor><mouse><pad></pad></mouse></monitor></toy></cat><cat><dog><bird></bird></dog></cat>")
     b, c = XML.xml_read(r)
     self.assertTrue(tostring(b,encoding='unicode') == tostring(fromstring("<cat><dog><bird><rat></rat></bird><chicken><goose></goose></chicken><egg></egg></dog><toy><car><race></race></car><computer><keyboard></keyboard></computer><monitor><mouse><pad></pad></mouse></monitor></toy></cat>"),encoding='unicode'))
     self.assertTrue(tostring(c,encoding='unicode') == tostring(fromstring("<cat><dog><bird></bird></dog></cat>"),encoding='unicode'))