#!/usr/bin/env python # ------------------------------ # projects/xml/RunXML.py # Copyright (C) 2013 # Glenn P. Downing # ------------------------------- # ------- # imports # ------- import sys import os from XML import solve # ---- # main # ---- for r,d,f in os.walk ( ".\Tests" ): with open ( "RunXML.out", "w" ) as output: for file in f: if file.endswith(".in"): with open ( ".\Tests\\" + file, "r" ) as input: solve(input, output) output.write ( "\n\n\n\n" )
#!/usr/bin/env python # ------------------------------ # projects/xml/RunXML.py # Copyright (C) 2013 # Glenn P. Downing # ------------------------------- # ------- # imports # ------- import sys from XML import solve # ---- # main # ---- solve(sys.stdin, sys.stdout)
def test_solve_2 (self) : r = StringIO.StringIO("<THU><g></g><aa></aa><b><c><e></e></c><d><f></f></d></b></THU><b><c></c><d></d></b>") w = StringIO.StringIO() solve(r, w) self.assert_(w.getvalue() == "1\n4\n")
def test_solve_3 (self) : r = StringIO.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>") w = StringIO.StringIO() solve(r, w) self.assert_(w.getvalue() == "2\n2\n7\n")
def test_solve_1 (self) : r = StringIO.StringIO("<THU></THU><aa></aa> ") w = StringIO.StringIO() solve(r, w) self.assert_(w.getvalue() == "0\n")