Exemple #1
0
 def testAppendChildRootElement(self):
     document = Document()
     element1 = Element("foo")
     element2 = Element("bar")
     document.appendChild(element1)
     self.assertEqual(document.rootElement, element1)
     self.assertFalse(document.canAppendChild(element2))
     self.assertIsNone(document.appendChild(element2))
Exemple #2
0
    def testDocument(self):
        doc = Document()
        self.assertEqual(doc.document, doc)

        n1 = Element("foo")
        self.assertIsNone(n1.document)

        n2 = Element("bar")
        n1.appendChild(n2)
        self.assertIsNone(n1.document)
        self.assertIsNone(n2.document)

        doc.appendChild(n1)
        self.assertEqual(n1.document, doc)
        self.assertEqual(n2.document, doc)
Exemple #3
0
 def testSave(self):
     document = Document()
     root = document.appendChild(Vgc())
     root.appendChild(Element("path"))
     document.save("testSave.vgc")