def test_print_2(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>\n")
     w = StringIO.StringIO()
     a = xml_read(r)
     data = xml_eval(a)
     xml_print(w, data)
     self.assert_(w.getvalue() == "2\n2\n7\n\n")
	def test_print_1 (self) :
		w = StringIO.StringIO()
		r = StringIO.StringIO("<Thu>\n<Win>\n</Win>\n</Thu>\n<Win></Win>\n")
		a = xml_read(r)
		l = xml_solve(a)
		xml_print(w, l)
		self.assert_(w.getvalue() == "1\n2\n")
 def test_print_1(self) :
     r = StringIO.StringIO("<THU>\n</THU>\n<THU></THU>\n")
     w = StringIO.StringIO()
     a = xml_read(r)
     data = xml_eval(a)
     xml_print(w, data)
     self.assert_(w.getvalue() == "1\n1\n\n")
	def test_print_3 (self) :
		w = StringIO.StringIO()
		r = StringIO.StringIO("<Cards>\n<Yu>\n<Gi>\n<Oh>\n</Oh>\n</Gi>\n</Yu>" +
			"\n</Cards>\n<Yu><Gi><Oh></Oh></Gi></Yu>\n")
		a = xml_read(r)
		l = xml_solve(a)
		xml_print(w, l)
		self.assert_(w.getvalue() == "1\n2\n")
    def test_print_5 (self) :
	"""
	Prints 1 element found @ pos 1
	"""
	w = StringIO.StringIO()
	matches = [1]
	
	xml_print(w, matches)
	self.assert_(w.getvalue() == "1\n1")
    def test_print_4 (self) :
	"""
	Prints 4 numbers
	"""
	w = StringIO.StringIO()
	matches = [99, 14, 51, 64]
	
	xml_print(w, matches)
	self.assert_(w.getvalue() == "4\n99\n14\n51\n64")
    def test_print_3 (self) :
	"""
	Tests case of 0 matches
	"""	
	w = StringIO.StringIO()
	matches = []
	
	xml_print(w, matches)
	self.assert_(w.getvalue() == "0")
示例#8
0
 def test_xml_print (self) :
     s = "<A><B><C><D><E><F></F></E></D></C></B></A>"
     c = fromstring(s)
     l = [c, c.find("B"), c.find("B").find("C"), c.find("B").find("C").find("D"), c.find("B").find("C").find("D").find("E"), c.find("B").find("C").find("D").find("E").find("F")]
     for i in l :
         i.text = i.tag
     r = io.StringIO()
     xml_print(l, r)
     self.assertTrue(r.getvalue() == "6\nA\nB\nC\nD\nE\nF")
    def test_print_1 (self) :
	"""
	Tests print case of 3 elements
	"""
	w = StringIO.StringIO()
	matches = [2, 5, 6]
	
	xml_print(w, matches)
	self.assert_(w.getvalue() == "3\n2\n5\n6")
    def test_print_2 (self) :
	"""
	Tests 6 cases to print
	"""
	x = StringIO.StringIO()
	matches = [3, 6, 34, 15, 19, 35]
	
	xml_print(x, matches)

	self.assert_(x.getvalue() == "6\n3\n6\n34\n15\n19\n35")
	def test_print_4 (self) :
		w = StringIO.StringIO()
		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>\n")
		a = xml_read(r)
		l = xml_solve(a)
		xml_print(w, l)
		self.assert_(w.getvalue() == "2\n2\n7\n")
 def test_print_2(self):
     w = StringIO.StringIO()
     xml_print(w, [1, [4]])
     self.assert_(w.getvalue() == "1\n4\n\n")
 def test_print_3(self):
     w = StringIO.StringIO()
     xml_print(w, [])
     self.assert_(w.getvalue() == "0")
 def test_print_2(self):
     w = StringIO.StringIO()
     xml_print(w, [1, 7])
     self.assert_(w.getvalue() == "2\n1\n7")
示例#15
0
 def test_print_1(self):
   w = StringIO.StringIO()
   xml_print(w, 3, [2,7,11])
   self.assert_(w.getvalue() == "3\n2\n7\n11\n")
 def test_print_3 (self) :
     w = StringIO.StringIO()
     v = 5
     xml_print(w, v)
     self.assert_(w.getvalue() == "5\n")
 def test_print_1 (self) :
     w = StringIO.StringIO()
     v = 2
     xml_print(w, v)
     self.assert_(w.getvalue() == "2\n")
	def test_print (self) :
		w = StringIO.StringIO()
		matches = [2, 7]
		xml_print(matches, w)
		assert(w.getvalue() == "2\n2\n7\n")
示例#19
0
 def test_xml_print_2 (self) :
     w = StringIO.StringIO()
     l = [7, 20, 398]
     xml_print(l, w)
     self.assertTrue(w.getvalue() == "3\n7\n20\n398")
示例#20
0
 def test_xml_print_1 (self) :
     w = StringIO.StringIO()
     l = [3, 4, 5]
     xml_print(l, w)
     self.assertTrue(w.getvalue() == "3\n3\n4\n5")
示例#21
0
 def test_print_4(self):
   w = StringIO.StringIO()
   xml_print(w, 1, [5])
   self.assert_(w.getvalue() == "1\n5\n")
示例#22
0
 def test_print_3(self):
   w = StringIO.StringIO()
   xml_print(w, 5, [1,5,8,11,15])
   self.assert_(w.getvalue() == "5\n1\n5\n8\n11\n15\n")
示例#23
0
 def test_print_1(self):
     w = io.StringIO()
     a = [5, 6, 7, 8]
     xml_print(a, w)
     self.assertTrue(w.getvalue() == "5\n6\n7\n8\n")
	def test_print_2 (self) :
		w = StringIO.StringIO()
		matches = []
		xml_print(matches, w)
		assert(w.getvalue() == "0\n")
示例#25
0
 def test_print_2(self):
     w = io.StringIO()
     a = [3,5,75,4,3,5]
     xml_print(a, w)
     self.assertTrue(w.getvalue() == "3\n5\n75\n4\n3\n5\n")
	def test_print_3 (self) :
		w = StringIO.StringIO()
		matches = ["abc", "def"]
		xml_print(matches, w)
		assert(w.getvalue() == "2\nabc\ndef\n")
 def test_print_2 (self) :
     w = StringIO.StringIO()
     v = 10
     xml_print(w, v)
     self.assert_(w.getvalue() == "10\n")
 def test_print_1(self):
     w = StringIO.StringIO()
     xml_print(w, [1,2,3])
     self.assert_(w.getvalue() == "3\n1\n2\n3")
示例#29
0
 def test_xml_print_3 (self) :
     w = StringIO.StringIO()
     l = [9, 90, 178, 999]
     xml_print(l, w)
     self.assertTrue(w.getvalue() == "4\n9\n90\n178\n999")
 def test_print_3(self):
     w = StringIO.StringIO()
     xml_print(w, [2, [3, 7]])
     self.assert_(w.getvalue() == "2\n3\n7\n\n")