def test_xml_2 (self) :
     r = StringIO.StringIO("<Sports>\n"\
                           "<Basketball>\n"\
                           "<athletes>\n"\
                           "<Kobe></Kobe>\n"\
                           "<Lebron></Lebron>\n"\
                           "<Durant></Durant>\n"\
                           "<Carmelo></Carmelo>\n"\
                           "</athletes>\n"\
                           "</Basketball>\n"\
                           "<Soccer>\n"\
                           "<athletes>\n"\
                           "<Messi></Messi>\n"\
                           "<CRonaldo></CRonaldo>\n"\
                           "<Iniesta></Iniesta>\n"\
                           "<Xavi></Xavi>\n"\
                           "<Kobe></Kobe>\n"\
                           "</athletes>\n"\
                           "</Soccer>\n"\
                           "<Legends>\n"\
                           "<Ronaldo></Ronaldo>\n"\
                           "<Zidane></Zidane>\n"\
                           "<Kobe></Kobe>\n"\
                           "<Figo></Figo>\n"\
                           "</Legends>\n"\
                           "<CareerPoints>\n"\
                           "<Kobe></Kobe>\n"\
                           "</CareerPoints>\n"\
                           "</Sports>\n"\
                           "<athletes><Kobe></Kobe></athletes>")
     w = StringIO.StringIO()
     xml(r, w)
     self.assert_(w.getvalue() == "2\n3\n9\n")
 def test_xml_3 (self) :
     r = StringIO.StringIO("<ANIMALS>\n"\
                           "<Dogs>\n"\
                           "<Rabbits></Rabbits>\n"\
                           "<Frogs></Frogs>\n"\
                           "</Dogs>\n"\
                           "<Cheetahs></Cheetahs>\n"\
                           "</ANIMALS>\n"\
                           "<Dogs><Cheetahs></Cheetahs></Dogs>")
     w = StringIO.StringIO()
     xml(r, w)
     self.assert_(w.getvalue() == "0\n")
 def test_xml_1 (self) :
     r = StringIO.StringIO("<THU>\n"\
                           "<Team>\n"\
                           "<ACRush></ACRush>\n"\
                           "<Jelly></Jelly>\n"\
                           "<Cooly></Cooly>\n"\
                           "</Team>\n"\
                           "<JiaJia>\n"\
                           "<Team>\n"\
                           "<Ahyangyi></Ahyangyi>\n"\
                           "<Dragon></Dragon>\n"\
                           "<Cooly><Amber></Amber></Cooly>\n"\
                           "</Team>\n"\
                           "</JiaJia>\n"\
                           "</THU>\n"\
                           "<Team><Cooly></Cooly></Team>")
     w = StringIO.StringIO()
     xml(r, w)
     self.assert_(w.getvalue() == "2\n2\n7\n")