def test_xml_reader_givenExample_2inputs(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>\n\n<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()
		xml_reader(r,w)
		self.assert_(w.getvalue() == "2\n2\n7\n\n2\n2\n7\n\n")
Esempio n. 2
0
# ------------------------------
# projects/collatz/RunCollatz.py
# Copyright (C) 2013
# Glenn P. Downing
# -------------------------------

"""
To run the program
    % python RunCollatz.py < RunCollatz.in > RunCollatz.out
    % chmod ugo+x RunCollatz.py
    % RunCollatz.py < RunCollatz.in > RunCollatz.out

To document the program
    % pydoc -w Collatz
"""

# -------
# imports
# -------

import sys

from XML import xml_reader

# ----
# main
# ----

xml_reader(sys.stdin, sys.stdout)
	def test_xml_reader_1query(self):
		r = StringIO.StringIO("<THU> </THU> <THU> </THU>")
		w = StringIO.StringIO()
		xml_reader(r,w)
		self.assert_(w.getvalue() == "1\n1\n\n")