def testAppendChildDocument(self): doc1 = Document() n1 = Element(doc1, "foo") doc2 = Document() self.assertFalse(doc1.canAppendChild(doc2)) self.assertFalse(n1.canAppendChild(doc1)) self.assertFalse(n1.canAppendChild(doc2))
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))
def testAppendChildRootElement(self): doc = Document() n1 = Element(doc, "foo") n2 = Element(n1, "bar") self.assertEqual(doc.rootElement, n1) self.assertFalse(doc.canAppendChild(n2))