Beispiel #1
0
    def test_append_patch(self):
	patch = Document.from_file(None, "fixtures/patch_add.xml").patches[0]
	original_doc = Document.from_file("example_doc", "fixtures/patch_template.xml")
	docs = patch.apply({"example": original_doc})
	doc = docs.values()[0]

	actual = etree.tostring(doc.lookup(""))
	expected = open("fixtures/patch_expected.xml").read()
	#print sub("\\s+"," ", actual).strip()
	#print sub("\\s+", " ", expected).strip()
	assert sub("\s+"," ", actual).strip() == sub("\s+", " ", expected).strip()
Beispiel #2
0
    def test_apply_create_patch(self):
	patch = Document.from_file(None, "fixtures/patch_create.xml").patches[0]
	docs = patch.apply({})
	doc = docs.values()[0]

	assert docs.keys()[0] == "example_doc"
	assert isinstance(doc, Document)
	assert doc.lookup_text("p1").startswith("I exist")
	assert doc.lookup_text("p2").startswith("This exists")
Beispiel #3
0
 def setUp(self):
     fn = "fixtures/VFUIK2009.xml"
     self.document = Document.from_file("TESTFOO", fn)
Beispiel #4
0
 def setUp(self):
     fn = "fixtures/with_patches.xml"
     self.document = Document.from_file("FOO", fn)