Ejemplo n.º 1
0
	def test_encodeEntities(self):
		doc = xtree('testdata/test_data.xml')
		doc.parse(False)
		r = xtree('testdata/r_test_encode.xml')
		r.parse(False)
		checker = LXMLOutputChecker()
		self.assertTrue(checker.compare_docs(r.tree.getroot(),doc.tree.getroot()))
Ejemplo n.º 2
0
 def test_encodeEntities(self):
     doc = xtree('testdata/test_data.xml')
     doc.parse(False)
     r = xtree('testdata/r_test_encode.xml')
     r.parse(False)
     checker = LXMLOutputChecker()
     self.assertTrue(
         checker.compare_docs(r.tree.getroot(), doc.tree.getroot()))
Ejemplo n.º 3
0
	def test_insertPIBefore(self):  
		doc = xtree('testdata/test_wrap.xml')
		doc.parse(False)
		for text in doc.tree.xpath('//text'):
			pi = etree.ProcessingInstruction('PI', 'Pb')
			doc.insert_node(text,'stuff',pi,True)
		r = xtree('testdata/r_test_insertPIBefore.xml')
		r.parse(False)
		checker = LXMLOutputChecker()
		self.assertTrue(checker.compare_docs(r.tree.getroot(),doc.tree.getroot()))
Ejemplo n.º 4
0
 def test_insertPIBefore(self):
     doc = xtree('testdata/test_wrap.xml')
     doc.parse(False)
     for text in doc.tree.xpath('//text'):
         pi = etree.ProcessingInstruction('PI', 'Pb')
         doc.insert_node(text, 'stuff', pi, True)
     r = xtree('testdata/r_test_insertPIBefore.xml')
     r.parse(False)
     checker = LXMLOutputChecker()
     self.assertTrue(
         checker.compare_docs(r.tree.getroot(), doc.tree.getroot()))
Ejemplo n.º 5
0
	def test_wrap(self):  
		doc = xtree('testdata/test_wrap.xml')
		doc.parse(False)
		if not doc.is_valid:
			if not doc.errors is None: print(doc.errors)
		for text in doc.tree.xpath('//text'):
			el = etree.Element('EL')
			el.set('atr', 'test')
			doc.wrap_text(text,'text',el)
		r = xtree('testdata/r_test_wrap.xml')
		r.parse(False)
		checker = LXMLOutputChecker()
		self.assertTrue(checker.compare_docs(r.tree.getroot(),doc.tree.getroot()))
Ejemplo n.º 6
0
 def test_wrap(self):
     doc = xtree('testdata/test_wrap.xml')
     doc.parse(False)
     if not doc.is_valid:
         if not doc.errors is None: print(doc.errors)
     for text in doc.tree.xpath('//text'):
         el = etree.Element('EL')
         el.set('atr', 'test')
         doc.wrap_text(text, 'text', el)
     r = xtree('testdata/r_test_wrap.xml')
     r.parse(False)
     checker = LXMLOutputChecker()
     self.assertTrue(
         checker.compare_docs(r.tree.getroot(), doc.tree.getroot()))