Back to index

python3.2  3.2.2
Classes | Public Member Functions | Private Member Functions
test.test_minidom.MinidomTest Class Reference

List of all members.

Classes

class  UserDataHandler

Public Member Functions

def confirm
def checkWholeText
def testParseFromFile
def testGetElementsByTagName
def testInsertBefore
def testInsertBeforeFragment
def testAppendChild
def testAppendChildFragment
def testReplaceChildFragment
def testLegalChildren
def testNamedNodeMapSetItem
def testNonZero
def testUnlink
def testContext
def testElement
def testAAA
def testAAB
def testAddAttr
def testDeleteAttr
def testRemoveAttr
def testRemoveAttrNS
def testRemoveAttributeNode
def testChangeAttr
def testGetAttrList
def testGetAttrValues
def testGetAttrLength
def testGetAttribute
def testGetAttributeNS
def testGetAttributeNode
def testGetElementsByTagNameNS
def get_empty_nodelist_from_elements_by_tagName_ns_helper
def testGetEmptyNodeListFromElementsByTagNameNS
def testElementReprAndStr
def testElementReprAndStrUnicode
def testElementReprAndStrUnicodeNS
def testAttributeRepr
def testTextNodeRepr
def testWriteXML
def testAltNewline
def testProcessingInstruction
def testProcessingInstructionRepr
def testTextRepr
def testWriteText
def testDocumentElement
def testTooManyDocumentElements
def testCreateElementNS
def testCreateAttributeNS
def testParse
def testParseString
def testComment
def testAttrListItem
def testAttrListItems
def testAttrListItemNS
def testAttrListKeys
def testAttrListKeysNS
def testRemoveNamedItem
def testRemoveNamedItemNS
def testAttrListValues
def testAttrListLength
def testAttrList__getitem__
def testAttrList__setitem__
def testSetAttrValueandNodeValue
def testParseElement
def testParseAttributes
def testParseElementNamespaces
def testParseAttributeNamespaces
def testParseProcessingInstructions
def testChildNodes
def testFirstChild
def testHasChildNodes
def testCloneElementShallow
def testCloneElementDeep
def testCloneDocumentShallow
def testCloneDocumentDeep
def testCloneDocumentTypeDeepOk
def testCloneDocumentTypeDeepNotOk
def testCloneDocumentTypeShallowOk
def testCloneDocumentTypeShallowNotOk
def check_import_document
def testImportDocumentShallow
def testImportDocumentDeep
def testImportDocumentTypeShallow
def testImportDocumentTypeDeep
def check_clone_attribute
def testCloneAttributeShallow
def testCloneAttributeDeep
def check_clone_pi
def testClonePIShallow
def testClonePIDeep
def testNormalize
def testNormalizeCombineAndNextSibling
def testNormalizeDeleteWithPrevSibling
def testNormalizeDeleteWithNextSibling
def testNormalizeDeleteWithTwoNonTextSiblings
def testNormalizeDeleteAndCombine
def testNormalizeRecursion
def testBug0777884
def testBug1433694
def testSiblings
def testParents
def testNodeListItem
def testSAX2DOM
def testEncodings
def testUserData
def checkRenameNodeSharedConstraints
def testRenameAttribute
def testRenameElement
def testRenameOther
def testWholeText
def testPatch1094164
def testReplaceWholeText
def testSchemaType
def testSetIdAttribute
def testSetIdAttributeNS
def testSetIdAttributeNode
def testPickledDocument
def testSerializeCommentNodeWithDoubleHyphen
def testEmptyXMLNSValue

Private Member Functions

def _create_fragment_test_nodes
def _testCloneElementCopiesAttributes
def _setupCloneElement

Detailed Description

Definition at line 47 of file test_minidom.py.


Member Function Documentation

Definition at line 110 of file test_minidom.py.

00110 
00111     def _create_fragment_test_nodes(self):
00112         dom = parseString("<doc/>")
00113         orig = dom.createTextNode("original")
00114         c1 = dom.createTextNode("foo")
00115         c2 = dom.createTextNode("bar")
00116         c3 = dom.createTextNode("bat")
00117         dom.documentElement.appendChild(orig)
00118         frag = dom.createDocumentFragment()
00119         frag.appendChild(c1)
00120         frag.appendChild(c2)
00121         frag.appendChild(c3)
00122         return dom, orig, c1, c2, c3, frag

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_minidom.MinidomTest._setupCloneElement (   self,
  deep 
) [private]

Definition at line 565 of file test_minidom.py.

00565 
00566     def _setupCloneElement(self, deep):
00567         dom = parseString("<doc attr='value'><foo/></doc>")
00568         root = dom.documentElement
00569         clone = root.cloneNode(deep)
00570         self._testCloneElementCopiesAttributes(
00571             root, clone, "testCloneElement" + (deep and "Deep" or "Shallow"))
00572         # mutilate the original so shared data is detected
00573         root.tagName = root.nodeName = "MODIFIED"
00574         root.setAttribute("attr", "NEW VALUE")
00575         root.setAttribute("added", "VALUE")
00576         return dom, clone

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_minidom.MinidomTest._testCloneElementCopiesAttributes (   self,
  e1,
  e2,
  test 
) [private]

Definition at line 545 of file test_minidom.py.

00545 
00546     def _testCloneElementCopiesAttributes(self, e1, e2, test):
00547         attrs1 = e1.attributes
00548         attrs2 = e2.attributes
00549         keys1 = list(attrs1.keys())
00550         keys2 = list(attrs2.keys())
00551         keys1.sort()
00552         keys2.sort()
00553         self.confirm(keys1 == keys2, "clone of element has same attribute keys")
00554         for i in range(len(keys1)):
00555             a1 = attrs1.item(i)
00556             a2 = attrs2.item(i)
00557             self.confirm(a1 is not a2
00558                     and a1.value == a2.value
00559                     and a1.nodeValue == a2.nodeValue
00560                     and a1.namespaceURI == a2.namespaceURI
00561                     and a1.localName == a2.localName
00562                     , "clone of attribute node has proper attribute values")
00563             self.confirm(a2.ownerElement is e2,
00564                     "clone of attribute node correctly owned")

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_minidom.MinidomTest.check_clone_attribute (   self,
  deep,
  testName 
)

Definition at line 715 of file test_minidom.py.

00715 
00716     def check_clone_attribute(self, deep, testName):
00717         doc = parseString("<doc attr='value'/>")
00718         attr = doc.documentElement.getAttributeNode("attr")
00719         self.assertNotEqual(attr, None)
00720         clone = attr.cloneNode(deep)
00721         self.confirm(not clone.isSameNode(attr))
00722         self.confirm(not attr.isSameNode(clone))
00723         self.confirm(clone.ownerElement is None,
00724                 testName + ": ownerElement should be None")
00725         self.confirm(clone.ownerDocument.isSameNode(attr.ownerDocument),
00726                 testName + ": ownerDocument does not match")
00727         self.confirm(clone.specified,
00728                 testName + ": cloned attribute must have specified == True")

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_minidom.MinidomTest.check_clone_pi (   self,
  deep,
  testName 
)

Definition at line 735 of file test_minidom.py.

00735 
00736     def check_clone_pi(self, deep, testName):
00737         doc = parseString("<?target data?><doc/>")
00738         pi = doc.firstChild
00739         self.assertEqual(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE)
00740         clone = pi.cloneNode(deep)
00741         self.confirm(clone.target == pi.target
00742                 and clone.data == pi.data)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_minidom.MinidomTest.check_import_document (   self,
  deep,
  testName 
)

Definition at line 690 of file test_minidom.py.

00690 
00691     def check_import_document(self, deep, testName):
00692         doc1 = parseString("<doc/>")
00693         doc2 = parseString("<doc/>")
00694         self.assertRaises(xml.dom.NotSupportedErr, doc1.importNode, doc2, deep)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1074 of file test_minidom.py.

01074 
01075     def checkRenameNodeSharedConstraints(self, doc, node):
01076         # Make sure illegal NS usage is detected:
01077         self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, node,
01078                           "http://xml.python.org/ns", "xmlns:foo")
01079         doc2 = parseString("<doc/>")
01080         self.assertRaises(xml.dom.WrongDocumentErr, doc2.renameNode, node,
01081                           xml.dom.EMPTY_NAMESPACE, "foo")

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_minidom.MinidomTest.checkWholeText (   self,
  node,
  s 
)

Definition at line 51 of file test_minidom.py.

00051 
00052     def checkWholeText(self, node, s):
00053         t = node.wholeText
00054         self.confirm(t == s, "looking for %s, found %s" % (repr(s), repr(t)))

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_minidom.MinidomTest.confirm (   self,
  test,
  testname = "Test" 
)

Definition at line 48 of file test_minidom.py.

00048 
00049     def confirm(self, test, testname = "Test"):
00050         self.assertTrue(test, testname)

Here is the call graph for this function:

Definition at line 379 of file test_minidom.py.

00379 
00380                                                               lname):
00381         nodelist = doc.getElementsByTagNameNS(nsuri, lname)
00382         self.confirm(len(nodelist) == 0)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 227 of file test_minidom.py.

00227 
00228     def testAAA(self):
00229         dom = parseString("<abc/>")
00230         el = dom.documentElement
00231         el.setAttribute("spam", "jam2")
00232         self.confirm(el.toxml() == '<abc spam="jam2"/>', "testAAA")
00233         a = el.getAttributeNode("spam")
00234         self.confirm(a.ownerDocument is dom,
00235                 "setAttribute() sets ownerDocument")
00236         self.confirm(a.ownerElement is dom.documentElement,
00237                 "setAttribute() sets ownerElement")
00238         dom.unlink()

Here is the call graph for this function:

Definition at line 239 of file test_minidom.py.

00239 
00240     def testAAB(self):
00241         dom = parseString("<abc/>")
00242         el = dom.documentElement
00243         el.setAttribute("spam", "jam")
00244         el.setAttribute("spam", "jam2")
00245         self.confirm(el.toxml() == '<abc spam="jam2"/>', "testAAB")
00246         dom.unlink()

Here is the call graph for this function:

Definition at line 247 of file test_minidom.py.

00247 
00248     def testAddAttr(self):
00249         dom = Document()
00250         child = dom.appendChild(dom.createElement("abc"))
00251 
00252         child.setAttribute("def", "ghi")
00253         self.confirm(child.getAttribute("def") == "ghi")
00254         self.confirm(child.attributes["def"].value == "ghi")
00255 
00256         child.setAttribute("jkl", "mno")
00257         self.confirm(child.getAttribute("jkl") == "mno")
00258         self.confirm(child.attributes["jkl"].value == "mno")
00259 
00260         self.confirm(len(child.attributes) == 2)
00261 
00262         child.setAttribute("def", "newval")
00263         self.confirm(child.getAttribute("def") == "newval")
00264         self.confirm(child.attributes["def"].value == "newval")
00265 
00266         self.confirm(len(child.attributes) == 2)
00267         dom.unlink()

Here is the call graph for this function:

Definition at line 442 of file test_minidom.py.

00442 
00443     def testAltNewline(self):
00444         str = '<?xml version="1.0" ?>\n<a b="c"/>\n'
00445         dom = parseString(str)
00446         domstr = dom.toprettyxml(newl="\r\n")
00447         dom.unlink()
00448         self.confirm(domstr == str.replace("\n", "\r\n"))

Here is the call graph for this function:

Definition at line 140 of file test_minidom.py.

00140 
00141     def testAppendChild(self):
00142         dom = parse(tstfile)
00143         dom.documentElement.appendChild(dom.createComment("Hello"))
00144         self.confirm(dom.documentElement.childNodes[-1].nodeName == "#comment")
00145         self.confirm(dom.documentElement.childNodes[-1].data == "Hello")
00146         dom.unlink()

Here is the call graph for this function:

Definition at line 147 of file test_minidom.py.

00147 
00148     def testAppendChildFragment(self):
00149         dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
00150         dom.documentElement.appendChild(frag)
00151         self.confirm(tuple(dom.documentElement.childNodes) ==
00152                      (orig, c1, c2, c3),
00153                      "appendChild(<fragment>)")
00154         frag.unlink()
00155         dom.unlink()

Here is the call graph for this function:

Definition at line 426 of file test_minidom.py.

00426 
00427     def testAttributeRepr(self):
00428         dom = Document()
00429         el = dom.appendChild(dom.createElement("abc"))
00430         node = el.setAttribute("abc", "def")
00431         self.confirm(str(node) == repr(node))
00432         dom.unlink()

Here is the call graph for this function:

Definition at line 523 of file test_minidom.py.

00523 
00524     def testAttrList__getitem__(self): pass

Definition at line 525 of file test_minidom.py.

00525 
00526     def testAttrList__setitem__(self): pass

Definition at line 490 of file test_minidom.py.

00490 
00491     def testAttrListItem(self): pass

Definition at line 494 of file test_minidom.py.

00494 
00495     def testAttrListItemNS(self): pass

Definition at line 492 of file test_minidom.py.

00492 
00493     def testAttrListItems(self): pass

Definition at line 496 of file test_minidom.py.

00496 
00497     def testAttrListKeys(self): pass

Definition at line 498 of file test_minidom.py.

00498 
00499     def testAttrListKeysNS(self): pass

Definition at line 521 of file test_minidom.py.

00521 
00522     def testAttrListLength(self): pass

Definition at line 519 of file test_minidom.py.

00519 
00520     def testAttrListValues(self): pass

Definition at line 935 of file test_minidom.py.

00935 
00936     def testBug0777884(self):
00937         doc = parseString("<o>text</o>")
00938         text = doc.documentElement.childNodes[0]
00939         self.assertEqual(text.nodeType, Node.TEXT_NODE)
00940         # Should run quietly, doing nothing.
00941         text.normalize()
00942         doc.unlink()

Here is the call graph for this function:

Definition at line 943 of file test_minidom.py.

00943 
00944     def testBug1433694(self):
00945         doc = parseString("<o><i/>t</o>")
00946         node = doc.documentElement
00947         node.childNodes[1].nodeValue = ""
00948         node.normalize()
00949         self.confirm(node.childNodes[-1].nextSibling is None,
00950                      "Final child's .nextSibling should be None")

Here is the call graph for this function:

Definition at line 312 of file test_minidom.py.

00312 
00313     def testChangeAttr(self):
00314         dom = parseString("<abc/>")
00315         el = dom.documentElement
00316         el.setAttribute("spam", "jam")
00317         self.confirm(len(el.attributes) == 1)
00318         el.setAttribute("spam", "bam")
00319         # Set this attribute to be an ID and make sure that doesn't change
00320         # when changing the value:
00321         el.setIdAttribute("spam")
00322         self.confirm(len(el.attributes) == 1
00323                 and el.attributes["spam"].value == "bam"
00324                 and el.attributes["spam"].nodeValue == "bam"
00325                 and el.getAttribute("spam") == "bam"
00326                 and el.getAttributeNode("spam").isId)
00327         el.attributes["spam"] = "ham"
00328         self.confirm(len(el.attributes) == 1
00329                 and el.attributes["spam"].value == "ham"
00330                 and el.attributes["spam"].nodeValue == "ham"
00331                 and el.getAttribute("spam") == "ham"
00332                 and el.attributes["spam"].isId)
00333         el.setAttribute("spam2", "bam")
00334         self.confirm(len(el.attributes) == 2
00335                 and el.attributes["spam"].value == "ham"
00336                 and el.attributes["spam"].nodeValue == "ham"
00337                 and el.getAttribute("spam") == "ham"
00338                 and el.attributes["spam2"].value == "bam"
00339                 and el.attributes["spam2"].nodeValue == "bam"
00340                 and el.getAttribute("spam2") == "bam")
00341         el.attributes["spam2"] = "bam2"
00342         self.confirm(len(el.attributes) == 2
00343                 and el.attributes["spam"].value == "ham"
00344                 and el.attributes["spam"].nodeValue == "ham"
00345                 and el.getAttribute("spam") == "ham"
00346                 and el.attributes["spam2"].value == "bam2"
00347                 and el.attributes["spam2"].nodeValue == "bam2"
00348                 and el.getAttribute("spam2") == "bam2")
00349         dom.unlink()

Here is the call graph for this function:

Definition at line 539 of file test_minidom.py.

00539 
00540     def testChildNodes(self): pass

Definition at line 732 of file test_minidom.py.

00732 
00733     def testCloneAttributeDeep(self):
00734         self.check_clone_attribute(1, "testCloneAttributeDeep")

Here is the call graph for this function:

Definition at line 729 of file test_minidom.py.

00729 
00730     def testCloneAttributeShallow(self):
00731         self.check_clone_attribute(0, "testCloneAttributeShallow")

Here is the call graph for this function:

Definition at line 607 of file test_minidom.py.

00607 
00608     def testCloneDocumentDeep(self):
00609         doc = parseString("<?xml version='1.0'?>\n"
00610                     "<!-- comment -->"
00611                     "<!DOCTYPE doc [\n"
00612                     "<!NOTATION notation SYSTEM 'http://xml.python.org/'>\n"
00613                     "]>\n"
00614                     "<doc attr='value'/>")
00615         doc2 = doc.cloneNode(1)
00616         self.confirm(not (doc.isSameNode(doc2) or doc2.isSameNode(doc)),
00617                 "testCloneDocumentDeep: document objects not distinct")
00618         self.confirm(len(doc.childNodes) == len(doc2.childNodes),
00619                 "testCloneDocumentDeep: wrong number of Document children")
00620         self.confirm(doc2.documentElement.nodeType == Node.ELEMENT_NODE,
00621                 "testCloneDocumentDeep: documentElement not an ELEMENT_NODE")
00622         self.confirm(doc2.documentElement.ownerDocument.isSameNode(doc2),
00623             "testCloneDocumentDeep: documentElement owner is not new document")
00624         self.confirm(not doc.documentElement.isSameNode(doc2.documentElement),
00625                 "testCloneDocumentDeep: documentElement should not be shared")
00626         if doc.doctype is not None:
00627             # check the doctype iff the original DOM maintained it
00628             self.confirm(doc2.doctype.nodeType == Node.DOCUMENT_TYPE_NODE,
00629                     "testCloneDocumentDeep: doctype not a DOCUMENT_TYPE_NODE")
00630             self.confirm(doc2.doctype.ownerDocument.isSameNode(doc2))
00631             self.confirm(not doc.doctype.isSameNode(doc2.doctype))

Here is the call graph for this function:

Definition at line 595 of file test_minidom.py.

00595 
00596     def testCloneDocumentShallow(self):
00597         doc = parseString("<?xml version='1.0'?>\n"
00598                     "<!-- comment -->"
00599                     "<!DOCTYPE doc [\n"
00600                     "<!NOTATION notation SYSTEM 'http://xml.python.org/'>\n"
00601                     "]>\n"
00602                     "<doc attr='value'/>")
00603         doc2 = doc.cloneNode(0)
00604         self.confirm(doc2 is None,
00605                 "testCloneDocumentShallow:"
00606                 " shallow cloning of documents makes no sense!")

Here is the call graph for this function:

Definition at line 666 of file test_minidom.py.

00666 
00667     def testCloneDocumentTypeDeepNotOk(self):
00668         doc = create_doc_with_doctype()
00669         clone = doc.doctype.cloneNode(1)
00670         self.confirm(clone is None, "testCloneDocumentTypeDeepNotOk")

Here is the call graph for this function:

Definition at line 632 of file test_minidom.py.

00632 
00633     def testCloneDocumentTypeDeepOk(self):
00634         doctype = create_nonempty_doctype()
00635         clone = doctype.cloneNode(1)
00636         self.confirm(clone is not None
00637                 and clone.nodeName == doctype.nodeName
00638                 and clone.name == doctype.name
00639                 and clone.publicId == doctype.publicId
00640                 and clone.systemId == doctype.systemId
00641                 and len(clone.entities) == len(doctype.entities)
00642                 and clone.entities.item(len(clone.entities)) is None
00643                 and len(clone.notations) == len(doctype.notations)
00644                 and clone.notations.item(len(clone.notations)) is None
00645                 and len(clone.childNodes) == 0)
00646         for i in range(len(doctype.entities)):
00647             se = doctype.entities.item(i)
00648             ce = clone.entities.item(i)
00649             self.confirm((not se.isSameNode(ce))
00650                     and (not ce.isSameNode(se))
00651                     and ce.nodeName == se.nodeName
00652                     and ce.notationName == se.notationName
00653                     and ce.publicId == se.publicId
00654                     and ce.systemId == se.systemId
00655                     and ce.encoding == se.encoding
00656                     and ce.actualEncoding == se.actualEncoding
00657                     and ce.version == se.version)
00658         for i in range(len(doctype.notations)):
00659             sn = doctype.notations.item(i)
00660             cn = clone.notations.item(i)
00661             self.confirm((not sn.isSameNode(cn))
00662                     and (not cn.isSameNode(sn))
00663                     and cn.nodeName == sn.nodeName
00664                     and cn.publicId == sn.publicId
00665                     and cn.systemId == sn.systemId)

Here is the call graph for this function:

Definition at line 685 of file test_minidom.py.

00685 
00686     def testCloneDocumentTypeShallowNotOk(self):
00687         doc = create_doc_with_doctype()
00688         clone = doc.doctype.cloneNode(0)
00689         self.confirm(clone is None, "testCloneDocumentTypeShallowNotOk")

Here is the call graph for this function:

Definition at line 671 of file test_minidom.py.

00671 
00672     def testCloneDocumentTypeShallowOk(self):
00673         doctype = create_nonempty_doctype()
00674         clone = doctype.cloneNode(0)
00675         self.confirm(clone is not None
00676                 and clone.nodeName == doctype.nodeName
00677                 and clone.name == doctype.name
00678                 and clone.publicId == doctype.publicId
00679                 and clone.systemId == doctype.systemId
00680                 and len(clone.entities) == 0
00681                 and clone.entities.item(0) is None
00682                 and len(clone.notations) == 0
00683                 and clone.notations.item(0) is None
00684                 and len(clone.childNodes) == 0)

Here is the call graph for this function:

Definition at line 586 of file test_minidom.py.

00586 
00587     def testCloneElementDeep(self):
00588         dom, clone = self._setupCloneElement(1)
00589         self.confirm(len(clone.childNodes) == 1
00590                 and clone.childNodes.length == 1
00591                 and clone.parentNode is None
00592                 and clone.toxml() == '<doc attr="value"><foo/></doc>'
00593                 , "testCloneElementDeep")
00594         dom.unlink()

Here is the call graph for this function:

Definition at line 577 of file test_minidom.py.

00577 
00578     def testCloneElementShallow(self):
00579         dom, clone = self._setupCloneElement(0)
00580         self.confirm(len(clone.childNodes) == 0
00581                 and clone.childNodes.length == 0
00582                 and clone.parentNode is None
00583                 and clone.toxml() == '<doc attr="value"/>'
00584                 , "testCloneElementShallow")
00585         dom.unlink()

Here is the call graph for this function:

Definition at line 746 of file test_minidom.py.

00746 
00747     def testClonePIDeep(self):
00748         self.check_clone_pi(1, "testClonePIDeep")

Here is the call graph for this function:

Definition at line 743 of file test_minidom.py.

00743 
00744     def testClonePIShallow(self):
00745         self.check_clone_pi(0, "testClonePIShallow")

Here is the call graph for this function:

Definition at line 488 of file test_minidom.py.

00488 
00489     def testComment(self): pass

Definition at line 216 of file test_minidom.py.

00216 
00217     def testContext(self):
00218         with parse(tstfile) as dom:
00219             self.assertTrue(dom.childNodes)
00220         self.assertFalse(dom.childNodes)

Here is the call graph for this function:

Definition at line 482 of file test_minidom.py.

00482 
00483     def testCreateAttributeNS(self): pass

Definition at line 480 of file test_minidom.py.

00480 
00481     def testCreateElementNS(self): pass

Definition at line 268 of file test_minidom.py.

00268 
00269     def testDeleteAttr(self):
00270         dom = Document()
00271         child = dom.appendChild(dom.createElement("abc"))
00272 
00273         self.confirm(len(child.attributes) == 0)
00274         child.setAttribute("def", "ghi")
00275         self.confirm(len(child.attributes) == 1)
00276         del child.attributes["def"]
00277         self.confirm(len(child.attributes) == 0)
00278         dom.unlink()

Here is the call graph for this function:

Definition at line 470 of file test_minidom.py.

00470 
00471     def testDocumentElement(self): pass

Definition at line 221 of file test_minidom.py.

00221 
00222     def testElement(self):
00223         dom = Document()
00224         dom.appendChild(dom.createElement("abc"))
00225         self.confirm(dom.documentElement)
00226         dom.unlink()

Here is the call graph for this function:

Definition at line 400 of file test_minidom.py.

00400 
00401     def testElementReprAndStr(self):
00402         dom = Document()
00403         el = dom.appendChild(dom.createElement("abc"))
00404         string1 = repr(el)
00405         string2 = str(el)
00406         self.confirm(string1 == string2)
00407         dom.unlink()

Here is the call graph for this function:

Definition at line 408 of file test_minidom.py.

00408 
00409     def testElementReprAndStrUnicode(self):
00410         dom = Document()
00411         el = dom.appendChild(dom.createElement("abc"))
00412         string1 = repr(el)
00413         string2 = str(el)
00414         self.confirm(string1 == string2)
00415         dom.unlink()

Here is the call graph for this function:

Definition at line 416 of file test_minidom.py.

00416 
00417     def testElementReprAndStrUnicodeNS(self):
00418         dom = Document()
00419         el = dom.appendChild(
00420             dom.createElementNS("http://www.slashdot.org", "slash:abc"))
00421         string1 = repr(el)
00422         string2 = str(el)
00423         self.confirm(string1 == string2)
00424         self.confirm("slash:abc" in string1)
00425         dom.unlink()

Here is the call graph for this function:

Definition at line 1473 of file test_minidom.py.

01473 
01474     def testEmptyXMLNSValue(self):
01475         doc = parseString("<element xmlns=''>\n"
01476                           "<foo/>\n</element>")
01477         doc2 = parseString(doc.toxml())
01478         self.confirm(doc2.namespaceURI == xml.dom.EMPTY_NAMESPACE)
01479 

Here is the call graph for this function:

Definition at line 1027 of file test_minidom.py.

01027 
01028     def testEncodings(self):
01029         doc = parseString('<foo>&#x20ac;</foo>')
01030         self.assertEqual(doc.toxml(),
01031                          '<?xml version="1.0" ?><foo>\u20ac</foo>')
01032         self.assertEqual(doc.toxml('utf-8'),
01033             b'<?xml version="1.0" encoding="utf-8"?><foo>\xe2\x82\xac</foo>')
01034         self.assertEqual(doc.toxml('iso-8859-15'),
01035             b'<?xml version="1.0" encoding="iso-8859-15"?><foo>\xa4</foo>')
01036 
01037         # Verify that character decoding errors throw exceptions instead
01038         # of crashing
01039         self.assertRaises(UnicodeDecodeError, parseString,
01040                 b'<fran\xe7ais>Comment \xe7a va ? Tr\xe8s bien ?</fran\xe7ais>')
01041 
01042         doc.unlink()

Here is the call graph for this function:

Definition at line 541 of file test_minidom.py.

00541 
00542     def testFirstChild(self): pass

Definition at line 357 of file test_minidom.py.

00357 
00358     def testGetAttribute(self): pass

Definition at line 361 of file test_minidom.py.

00361 
00362     def testGetAttributeNode(self): pass

Definition at line 359 of file test_minidom.py.

00359 
00360     def testGetAttributeNS(self): pass

Definition at line 355 of file test_minidom.py.

00355 
00356     def testGetAttrLength(self): pass

Definition at line 350 of file test_minidom.py.

00350 
00351     def testGetAttrList(self):
00352         pass

Definition at line 353 of file test_minidom.py.

00353 
00354     def testGetAttrValues(self): pass

Definition at line 61 of file test_minidom.py.

00061 
00062     def testGetElementsByTagName(self):
00063         dom = parse(tstfile)
00064         self.confirm(dom.getElementsByTagName("LI") == \
00065                 dom.documentElement.getElementsByTagName("LI"))
00066         dom.unlink()

Here is the call graph for this function:

Definition at line 363 of file test_minidom.py.

00363 
00364     def testGetElementsByTagNameNS(self):
00365         d="""<foo xmlns:minidom='http://pyxml.sf.net/minidom'>
00366         <minidom:myelem/>
00367         </foo>"""
00368         dom = parseString(d)
00369         elems = dom.getElementsByTagNameNS("http://pyxml.sf.net/minidom",
00370                                            "myelem")
00371         self.confirm(len(elems) == 1
00372                 and elems[0].namespaceURI == "http://pyxml.sf.net/minidom"
00373                 and elems[0].localName == "myelem"
00374                 and elems[0].prefix == "minidom"
00375                 and elems[0].tagName == "minidom:myelem"
00376                 and elems[0].nodeName == "minidom:myelem")
00377         dom.unlink()

Here is the call graph for this function:

Definition at line 383 of file test_minidom.py.

00383 
00384     def testGetEmptyNodeListFromElementsByTagNameNS(self):
00385         doc = parseString('<doc/>')
00386         self.get_empty_nodelist_from_elements_by_tagName_ns_helper(
00387             doc, 'http://xml.python.org/namespaces/a', 'localname')
00388         self.get_empty_nodelist_from_elements_by_tagName_ns_helper(
00389             doc, '*', 'splat')
00390         self.get_empty_nodelist_from_elements_by_tagName_ns_helper(
00391             doc, 'http://xml.python.org/namespaces/a', '*')
00392 
00393         doc = parseString('<doc xmlns="http://xml.python.org/splat"><e/></doc>')
00394         self.get_empty_nodelist_from_elements_by_tagName_ns_helper(
00395             doc, "http://xml.python.org/splat", "not-there")
00396         self.get_empty_nodelist_from_elements_by_tagName_ns_helper(
00397             doc, "*", "not-there")
00398         self.get_empty_nodelist_from_elements_by_tagName_ns_helper(
00399             doc, "http://somewhere.else.net/not-there", "e")

Here is the call graph for this function:

Definition at line 543 of file test_minidom.py.

00543 
00544     def testHasChildNodes(self): pass

Definition at line 698 of file test_minidom.py.

00698 
00699     def testImportDocumentDeep(self):
00700         self.check_import_document(1, "testImportDocumentDeep")

Here is the call graph for this function:

Definition at line 695 of file test_minidom.py.

00695 
00696     def testImportDocumentShallow(self):
00697         self.check_import_document(0, "testImportDocumentShallow")

Here is the call graph for this function:

Definition at line 707 of file test_minidom.py.

00707 
00708     def testImportDocumentTypeDeep(self):
00709         src = create_doc_with_doctype()
00710         target = create_doc_without_doctype()
00711         self.assertRaises(xml.dom.NotSupportedErr, target.importNode,
00712                           src.doctype, 1)

Here is the call graph for this function:

Definition at line 701 of file test_minidom.py.

00701 
00702     def testImportDocumentTypeShallow(self):
00703         src = create_doc_with_doctype()
00704         target = create_doc_without_doctype()
00705         self.assertRaises(xml.dom.NotSupportedErr, target.importNode,
00706                           src.doctype, 0)

Here is the call graph for this function:

Definition at line 67 of file test_minidom.py.

00067 
00068     def testInsertBefore(self):
00069         dom = parseString("<doc><foo/></doc>")
00070         root = dom.documentElement
00071         elem = root.childNodes[0]
00072         nelem = dom.createElement("element")
00073         root.insertBefore(nelem, elem)
00074         self.confirm(len(root.childNodes) == 2
00075                 and root.childNodes.length == 2
00076                 and root.childNodes[0] is nelem
00077                 and root.childNodes.item(0) is nelem
00078                 and root.childNodes[1] is elem
00079                 and root.childNodes.item(1) is elem
00080                 and root.firstChild is nelem
00081                 and root.lastChild is elem
00082                 and root.toxml() == "<doc><element/><foo/></doc>"
00083                 , "testInsertBefore -- node properly placed in tree")
00084         nelem = dom.createElement("element")
00085         root.insertBefore(nelem, None)
00086         self.confirm(len(root.childNodes) == 3
00087                 and root.childNodes.length == 3
00088                 and root.childNodes[1] is elem
00089                 and root.childNodes.item(1) is elem
00090                 and root.childNodes[2] is nelem
00091                 and root.childNodes.item(2) is nelem
00092                 and root.lastChild is nelem
00093                 and nelem.previousSibling is elem
00094                 and root.toxml() == "<doc><element/><foo/><element/></doc>"
00095                 , "testInsertBefore -- node properly placed in tree")
00096         nelem2 = dom.createElement("bar")
00097         root.insertBefore(nelem2, nelem)
00098         self.confirm(len(root.childNodes) == 4
00099                 and root.childNodes.length == 4
00100                 and root.childNodes[2] is nelem2
00101                 and root.childNodes.item(2) is nelem2
00102                 and root.childNodes[3] is nelem
00103                 and root.childNodes.item(3) is nelem
00104                 and nelem2.nextSibling is nelem
00105                 and nelem.previousSibling is nelem2
00106                 and root.toxml() ==
00107                 "<doc><element/><foo/><bar/><element/></doc>"
00108                 , "testInsertBefore -- node properly placed in tree")
00109         dom.unlink()

Here is the call graph for this function:

Definition at line 123 of file test_minidom.py.

00123 
00124     def testInsertBeforeFragment(self):
00125         dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
00126         dom.documentElement.insertBefore(frag, None)
00127         self.confirm(tuple(dom.documentElement.childNodes) ==
00128                      (orig, c1, c2, c3),
00129                      "insertBefore(<fragment>, None)")
00130         frag.unlink()
00131         dom.unlink()
00132 
00133         dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
00134         dom.documentElement.insertBefore(frag, orig)
00135         self.confirm(tuple(dom.documentElement.childNodes) ==
00136                      (c1, c2, c3, orig),
00137                      "insertBefore(<fragment>, orig)")
00138         frag.unlink()
00139         dom.unlink()

Here is the call graph for this function:

Definition at line 165 of file test_minidom.py.

00165 
00166     def testLegalChildren(self):
00167         dom = Document()
00168         elem = dom.createElement('element')
00169         text = dom.createTextNode('text')
00170         self.assertRaises(xml.dom.HierarchyRequestErr, dom.appendChild, text)
00171 
00172         dom.appendChild(elem)
00173         self.assertRaises(xml.dom.HierarchyRequestErr, dom.insertBefore, text,
00174                           elem)
00175         self.assertRaises(xml.dom.HierarchyRequestErr, dom.replaceChild, text,
00176                           elem)
00177 
00178         nodemap = elem.attributes
00179         self.assertRaises(xml.dom.HierarchyRequestErr, nodemap.setNamedItem,
00180                           text)
00181         self.assertRaises(xml.dom.HierarchyRequestErr, nodemap.setNamedItemNS,
00182                           text)
00183 
00184         elem.appendChild(text)
00185         dom.unlink()

Here is the call graph for this function:

Definition at line 186 of file test_minidom.py.

00186 
00187     def testNamedNodeMapSetItem(self):
00188         dom = Document()
00189         elem = dom.createElement('element')
00190         attrs = elem.attributes
00191         attrs["foo"] = "bar"
00192         a = attrs.item(0)
00193         self.confirm(a.ownerDocument is dom,
00194                 "NamedNodeMap.__setitem__() sets ownerDocument")
00195         self.confirm(a.ownerElement is elem,
00196                 "NamedNodeMap.__setitem__() sets ownerElement")
00197         self.confirm(a.value == "bar",
00198                 "NamedNodeMap.__setitem__() sets value")
00199         self.confirm(a.nodeValue == "bar",
00200                 "NamedNodeMap.__setitem__() sets nodeValue")
00201         elem.unlink()
00202         dom.unlink()

Here is the call graph for this function:

Definition at line 980 of file test_minidom.py.

00980 
00981     def testNodeListItem(self):
00982         doc = parseString("<doc><e/><e/></doc>")
00983         children = doc.childNodes
00984         docelem = children[0]
00985         self.confirm(children[0] is children.item(0)
00986                 and children.item(1) is None
00987                 and docelem.childNodes.item(0) is docelem.childNodes[0]
00988                 and docelem.childNodes.item(1) is docelem.childNodes[1]
00989                 and docelem.childNodes.item(0).childNodes.item(0) is None,
00990                 "test NodeList.item()")
00991         doc.unlink()

Here is the call graph for this function:

Definition at line 203 of file test_minidom.py.

00203 
00204     def testNonZero(self):
00205         dom = parse(tstfile)
00206         self.confirm(dom)# should not be zero
00207         dom.appendChild(dom.createComment("foo"))
00208         self.confirm(not dom.childNodes[-1].childNodes)
00209         dom.unlink()

Here is the call graph for this function:

Definition at line 749 of file test_minidom.py.

00749 
00750     def testNormalize(self):
00751         doc = parseString("<doc/>")
00752         root = doc.documentElement
00753         root.appendChild(doc.createTextNode("first"))
00754         root.appendChild(doc.createTextNode("second"))
00755         self.confirm(len(root.childNodes) == 2
00756                 and root.childNodes.length == 2,
00757                 "testNormalize -- preparation")
00758         doc.normalize()
00759         self.confirm(len(root.childNodes) == 1
00760                 and root.childNodes.length == 1
00761                 and root.firstChild is root.lastChild
00762                 and root.firstChild.data == "firstsecond"
00763                 , "testNormalize -- result")
00764         doc.unlink()
00765 
00766         doc = parseString("<doc/>")
00767         root = doc.documentElement
00768         root.appendChild(doc.createTextNode(""))
00769         doc.normalize()
00770         self.confirm(len(root.childNodes) == 0
00771                 and root.childNodes.length == 0,
00772                 "testNormalize -- single empty node removed")
00773         doc.unlink()

Here is the call graph for this function:

Definition at line 774 of file test_minidom.py.

00774 
00775     def testNormalizeCombineAndNextSibling(self):
00776         doc = parseString("<doc/>")
00777         root = doc.documentElement
00778         root.appendChild(doc.createTextNode("first"))
00779         root.appendChild(doc.createTextNode("second"))
00780         root.appendChild(doc.createElement("i"))
00781         self.confirm(len(root.childNodes) == 3
00782                 and root.childNodes.length == 3,
00783                 "testNormalizeCombineAndNextSibling -- preparation")
00784         doc.normalize()
00785         self.confirm(len(root.childNodes) == 2
00786                 and root.childNodes.length == 2
00787                 and root.firstChild.data == "firstsecond"
00788                 and root.firstChild is not root.lastChild
00789                 and root.firstChild.nextSibling is root.lastChild
00790                 and root.firstChild.previousSibling is None
00791                 and root.lastChild.previousSibling is root.firstChild
00792                 and root.lastChild.nextSibling is None
00793                 , "testNormalizeCombinedAndNextSibling -- result")
00794         doc.unlink()

Here is the call graph for this function:

Definition at line 851 of file test_minidom.py.

00851 
00852     def testNormalizeDeleteAndCombine(self):
00853         doc = parseString("<doc/>")
00854         root = doc.documentElement
00855         root.appendChild(doc.createTextNode(""))
00856         root.appendChild(doc.createTextNode("second"))
00857         root.appendChild(doc.createTextNode(""))
00858         root.appendChild(doc.createTextNode("fourth"))
00859         root.appendChild(doc.createTextNode(""))
00860         self.confirm(len(root.childNodes) == 5
00861                 and root.childNodes.length == 5,
00862                 "testNormalizeDeleteAndCombine -- preparation")
00863         doc.normalize()
00864         self.confirm(len(root.childNodes) == 1
00865                 and root.childNodes.length == 1
00866                 and root.firstChild is root.lastChild
00867                 and root.firstChild.data == "secondfourth"
00868                 and root.firstChild.previousSibling is None
00869                 and root.firstChild.nextSibling is None
00870                 , "testNormalizeDeleteAndCombine -- result")
00871         doc.unlink()

Here is the call graph for this function:

Definition at line 813 of file test_minidom.py.

00813 
00814     def testNormalizeDeleteWithNextSibling(self):
00815         doc = parseString("<doc/>")
00816         root = doc.documentElement
00817         root.appendChild(doc.createTextNode(""))
00818         root.appendChild(doc.createTextNode("second"))
00819         self.confirm(len(root.childNodes) == 2
00820                 and root.childNodes.length == 2,
00821                 "testNormalizeDeleteWithNextSibling -- preparation")
00822         doc.normalize()
00823         self.confirm(len(root.childNodes) == 1
00824                 and root.childNodes.length == 1
00825                 and root.firstChild.data == "second"
00826                 and root.firstChild is root.lastChild
00827                 and root.firstChild.nextSibling is None
00828                 and root.firstChild.previousSibling is None
00829                 , "testNormalizeDeleteWithNextSibling -- result")
00830         doc.unlink()

Here is the call graph for this function:

Definition at line 795 of file test_minidom.py.

00795 
00796     def testNormalizeDeleteWithPrevSibling(self):
00797         doc = parseString("<doc/>")
00798         root = doc.documentElement
00799         root.appendChild(doc.createTextNode("first"))
00800         root.appendChild(doc.createTextNode(""))
00801         self.confirm(len(root.childNodes) == 2
00802                 and root.childNodes.length == 2,
00803                 "testNormalizeDeleteWithPrevSibling -- preparation")
00804         doc.normalize()
00805         self.confirm(len(root.childNodes) == 1
00806                 and root.childNodes.length == 1
00807                 and root.firstChild.data == "first"
00808                 and root.firstChild is root.lastChild
00809                 and root.firstChild.nextSibling is None
00810                 and root.firstChild.previousSibling is None
00811                 , "testNormalizeDeleteWithPrevSibling -- result")
00812         doc.unlink()

Here is the call graph for this function:

Definition at line 831 of file test_minidom.py.

00831 
00832     def testNormalizeDeleteWithTwoNonTextSiblings(self):
00833         doc = parseString("<doc/>")
00834         root = doc.documentElement
00835         root.appendChild(doc.createElement("i"))
00836         root.appendChild(doc.createTextNode(""))
00837         root.appendChild(doc.createElement("i"))
00838         self.confirm(len(root.childNodes) == 3
00839                 and root.childNodes.length == 3,
00840                 "testNormalizeDeleteWithTwoSiblings -- preparation")
00841         doc.normalize()
00842         self.confirm(len(root.childNodes) == 2
00843                 and root.childNodes.length == 2
00844                 and root.firstChild is not root.lastChild
00845                 and root.firstChild.nextSibling is root.lastChild
00846                 and root.firstChild.previousSibling is None
00847                 and root.lastChild.previousSibling is root.firstChild
00848                 and root.lastChild.nextSibling is None
00849                 , "testNormalizeDeleteWithTwoSiblings -- result")
00850         doc.unlink()

Here is the call graph for this function:

Definition at line 872 of file test_minidom.py.

00872 
00873     def testNormalizeRecursion(self):
00874         doc = parseString("<doc>"
00875                             "<o>"
00876                               "<i/>"
00877                               "t"
00878                               #
00879                               #x
00880                             "</o>"
00881                             "<o>"
00882                               "<o>"
00883                                 "t2"
00884                                 #x2
00885                               "</o>"
00886                               "t3"
00887                               #x3
00888                             "</o>"
00889                             #
00890                           "</doc>")
00891         root = doc.documentElement
00892         root.childNodes[0].appendChild(doc.createTextNode(""))
00893         root.childNodes[0].appendChild(doc.createTextNode("x"))
00894         root.childNodes[1].childNodes[0].appendChild(doc.createTextNode("x2"))
00895         root.childNodes[1].appendChild(doc.createTextNode("x3"))
00896         root.appendChild(doc.createTextNode(""))
00897         self.confirm(len(root.childNodes) == 3
00898                 and root.childNodes.length == 3
00899                 and len(root.childNodes[0].childNodes) == 4
00900                 and root.childNodes[0].childNodes.length == 4
00901                 and len(root.childNodes[1].childNodes) == 3
00902                 and root.childNodes[1].childNodes.length == 3
00903                 and len(root.childNodes[1].childNodes[0].childNodes) == 2
00904                 and root.childNodes[1].childNodes[0].childNodes.length == 2
00905                 , "testNormalize2 -- preparation")
00906         doc.normalize()
00907         self.confirm(len(root.childNodes) == 2
00908                 and root.childNodes.length == 2
00909                 and len(root.childNodes[0].childNodes) == 2
00910                 and root.childNodes[0].childNodes.length == 2
00911                 and len(root.childNodes[1].childNodes) == 2
00912                 and root.childNodes[1].childNodes.length == 2
00913                 and len(root.childNodes[1].childNodes[0].childNodes) == 1
00914                 and root.childNodes[1].childNodes[0].childNodes.length == 1
00915                 , "testNormalize2 -- childNodes lengths")
00916         self.confirm(root.childNodes[0].childNodes[1].data == "tx"
00917                 and root.childNodes[1].childNodes[0].childNodes[0].data == "t2x2"
00918                 and root.childNodes[1].childNodes[1].data == "t3x3"
00919                 , "testNormalize2 -- joined text fields")
00920         self.confirm(root.childNodes[0].childNodes[1].nextSibling is None
00921                 and root.childNodes[0].childNodes[1].previousSibling
00922                         is root.childNodes[0].childNodes[0]
00923                 and root.childNodes[0].childNodes[0].previousSibling is None
00924                 and root.childNodes[0].childNodes[0].nextSibling
00925                         is root.childNodes[0].childNodes[1]
00926                 and root.childNodes[1].childNodes[1].nextSibling is None
00927                 and root.childNodes[1].childNodes[1].previousSibling
00928                         is root.childNodes[1].childNodes[0]
00929                 and root.childNodes[1].childNodes[0].previousSibling is None
00930                 and root.childNodes[1].childNodes[0].nextSibling
00931                         is root.childNodes[1].childNodes[1]
00932                 , "testNormalize2 -- sibling pointers")
00933         doc.unlink()
00934 

Here is the call graph for this function:

Definition at line 965 of file test_minidom.py.

00965 
00966     def testParents(self):
00967         doc = parseString(
00968             "<doc><elm1><elm2/><elm2><elm3/></elm2></elm1></doc>")
00969         root = doc.documentElement
00970         elm1 = root.childNodes[0]
00971         (elm2a, elm2b) = elm1.childNodes
00972         elm3 = elm2b.childNodes[0]
00973 
00974         self.confirm(root.parentNode is doc and
00975                 elm1.parentNode is root and
00976                 elm2a.parentNode is elm1 and
00977                 elm2b.parentNode is elm1 and
00978                 elm3.parentNode is elm2b, "testParents")
00979         doc.unlink()

Here is the call graph for this function:

Definition at line 484 of file test_minidom.py.

00484 
00485     def testParse(self): pass

Definition at line 535 of file test_minidom.py.

00535 
00536     def testParseAttributeNamespaces(self): pass

Definition at line 531 of file test_minidom.py.

00531 
00532     def testParseAttributes(self): pass

Definition at line 529 of file test_minidom.py.

00529 
00530     def testParseElement(self): pass

Definition at line 533 of file test_minidom.py.

00533 
00534     def testParseElementNamespaces(self): pass

Definition at line 55 of file test_minidom.py.

00055 
00056     def testParseFromFile(self):
00057         with open(tstfile) as file:
00058             dom = parse(file)
00059             dom.unlink()
00060             self.confirm(isinstance(dom, Document))

Here is the call graph for this function:

Definition at line 537 of file test_minidom.py.

00537 
00538     def testParseProcessingInstructions(self): pass

Definition at line 486 of file test_minidom.py.

00486 
00487     def testParseString(self): pass

Definition at line 1248 of file test_minidom.py.

01248 
01249     def testPatch1094164(self):
01250         doc = parseString("<doc><e/></doc>")
01251         elem = doc.documentElement
01252         e = elem.firstChild
01253         self.confirm(e.parentNode is elem, "Before replaceChild()")
01254         # Check that replacing a child with itself leaves the tree unchanged
01255         elem.replaceChild(e, e)
01256         self.confirm(e.parentNode is elem, "After replaceChild()")

Here is the call graph for this function:

Definition at line 1422 of file test_minidom.py.

01422 
01423     def testPickledDocument(self):
01424         doc = parseString("<?xml version='1.0' encoding='us-ascii'?>\n"
01425                     "<!DOCTYPE doc PUBLIC 'http://xml.python.org/public'"
01426                     " 'http://xml.python.org/system' [\n"
01427                     "  <!ELEMENT e EMPTY>\n"
01428                     "  <!ENTITY ent SYSTEM 'http://xml.python.org/entity'>\n"
01429                     "]><doc attr='value'> text\n"
01430                     "<?pi sample?> <!-- comment --> <e/> </doc>")
01431         s = pickle.dumps(doc)
01432         doc2 = pickle.loads(s)
01433         stack = [(doc, doc2)]
01434         while stack:
01435             n1, n2 = stack.pop()
01436             self.confirm(n1.nodeType == n2.nodeType
01437                     and len(n1.childNodes) == len(n2.childNodes)
01438                     and n1.nodeName == n2.nodeName
01439                     and not n1.isSameNode(n2)
01440                     and not n2.isSameNode(n1))
01441             if n1.nodeType == Node.DOCUMENT_TYPE_NODE:
01442                 len(n1.entities)
01443                 len(n2.entities)
01444                 len(n1.notations)
01445                 len(n2.notations)
01446                 self.confirm(len(n1.entities) == len(n2.entities)
01447                         and len(n1.notations) == len(n2.notations))
01448                 for i in range(len(n1.notations)):
01449                     # XXX this loop body doesn't seem to be executed?
01450                     no1 = n1.notations.item(i)
01451                     no2 = n1.notations.item(i)
01452                     self.confirm(no1.name == no2.name
01453                             and no1.publicId == no2.publicId
01454                             and no1.systemId == no2.systemId)
01455                     stack.append((no1, no2))
01456                 for i in range(len(n1.entities)):
01457                     e1 = n1.entities.item(i)
01458                     e2 = n2.entities.item(i)
01459                     self.confirm(e1.notationName == e2.notationName
01460                             and e1.publicId == e2.publicId
01461                             and e1.systemId == e2.systemId)
01462                     stack.append((e1, e2))
01463             if n1.nodeType != Node.DOCUMENT_NODE:
01464                 self.confirm(n1.ownerDocument.isSameNode(doc)
01465                         and n2.ownerDocument.isSameNode(doc2))
01466             for i in range(len(n1.childNodes)):
01467                 stack.append((n1.childNodes[i], n2.childNodes[i]))

Here is the call graph for this function:

Definition at line 449 of file test_minidom.py.

00449 
00450     def testProcessingInstruction(self):
00451         dom = parseString('<e><?mypi \t\n data \t\n ?></e>')
00452         pi = dom.documentElement.firstChild
00453         self.confirm(pi.target == "mypi"
00454                 and pi.data == "data \t\n "
00455                 and pi.nodeName == "mypi"
00456                 and pi.nodeType == Node.PROCESSING_INSTRUCTION_NODE
00457                 and pi.attributes is None
00458                 and not pi.hasChildNodes()
00459                 and len(pi.childNodes) == 0
00460                 and pi.firstChild is None
00461                 and pi.lastChild is None
00462                 and pi.localName is None
00463                 and pi.namespaceURI == xml.dom.EMPTY_NAMESPACE)

Here is the call graph for this function:

Definition at line 464 of file test_minidom.py.

00464 
00465     def testProcessingInstructionRepr(self): pass

Definition at line 279 of file test_minidom.py.

00279 
00280     def testRemoveAttr(self):
00281         dom = Document()
00282         child = dom.appendChild(dom.createElement("abc"))
00283 
00284         child.setAttribute("def", "ghi")
00285         self.confirm(len(child.attributes) == 1)
00286         child.removeAttribute("def")
00287         self.confirm(len(child.attributes) == 0)
00288         dom.unlink()

Here is the call graph for this function:

Definition at line 301 of file test_minidom.py.

00301 
00302     def testRemoveAttributeNode(self):
00303         dom = Document()
00304         child = dom.appendChild(dom.createElement("foo"))
00305         child.setAttribute("spam", "jam")
00306         self.confirm(len(child.attributes) == 1)
00307         node = child.getAttributeNode("spam")
00308         child.removeAttributeNode(node)
00309         self.confirm(len(child.attributes) == 0
00310                 and child.getAttributeNode("spam") is None)
00311         dom.unlink()

Here is the call graph for this function:

Definition at line 289 of file test_minidom.py.

00289 
00290     def testRemoveAttrNS(self):
00291         dom = Document()
00292         child = dom.appendChild(
00293                 dom.createElementNS("http://www.python.org", "python:abc"))
00294         child.setAttributeNS("http://www.w3.org", "xmlns:python",
00295                                                 "http://www.python.org")
00296         child.setAttributeNS("http://www.python.org", "python:abcattr", "foo")
00297         self.confirm(len(child.attributes) == 2)
00298         child.removeAttributeNS("http://www.python.org", "abcattr")
00299         self.confirm(len(child.attributes) == 1)
00300         dom.unlink()

Here is the call graph for this function:

Definition at line 500 of file test_minidom.py.

00500 
00501     def testRemoveNamedItem(self):
00502         doc = parseString("<doc a=''/>")
00503         e = doc.documentElement
00504         attrs = e.attributes
00505         a1 = e.getAttributeNode("a")
00506         a2 = attrs.removeNamedItem("a")
00507         self.confirm(a1.isSameNode(a2))
00508         self.assertRaises(xml.dom.NotFoundErr, attrs.removeNamedItem, "a")

Here is the call graph for this function:

Definition at line 509 of file test_minidom.py.

00509 
00510     def testRemoveNamedItemNS(self):
00511         doc = parseString("<doc xmlns:a='http://xml.python.org/' a:b=''/>")
00512         e = doc.documentElement
00513         attrs = e.attributes
00514         a1 = e.getAttributeNodeNS("http://xml.python.org/", "b")
00515         a2 = attrs.removeNamedItemNS("http://xml.python.org/", "b")
00516         self.confirm(a1.isSameNode(a2))
00517         self.assertRaises(xml.dom.NotFoundErr, attrs.removeNamedItemNS,
00518                           "http://xml.python.org/", "b")

Here is the call graph for this function:

Definition at line 1082 of file test_minidom.py.

01082 
01083     def testRenameAttribute(self):
01084         doc = parseString("<doc a='v'/>")
01085         elem = doc.documentElement
01086         attrmap = elem.attributes
01087         attr = elem.attributes['a']
01088 
01089         # Simple renaming
01090         attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "b")
01091         self.confirm(attr.name == "b"
01092                 and attr.nodeName == "b"
01093                 and attr.localName is None
01094                 and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE
01095                 and attr.prefix is None
01096                 and attr.value == "v"
01097                 and elem.getAttributeNode("a") is None
01098                 and elem.getAttributeNode("b").isSameNode(attr)
01099                 and attrmap["b"].isSameNode(attr)
01100                 and attr.ownerDocument.isSameNode(doc)
01101                 and attr.ownerElement.isSameNode(elem))
01102 
01103         # Rename to have a namespace, no prefix
01104         attr = doc.renameNode(attr, "http://xml.python.org/ns", "c")
01105         self.confirm(attr.name == "c"
01106                 and attr.nodeName == "c"
01107                 and attr.localName == "c"
01108                 and attr.namespaceURI == "http://xml.python.org/ns"
01109                 and attr.prefix is None
01110                 and attr.value == "v"
01111                 and elem.getAttributeNode("a") is None
01112                 and elem.getAttributeNode("b") is None
01113                 and elem.getAttributeNode("c").isSameNode(attr)
01114                 and elem.getAttributeNodeNS(
01115                     "http://xml.python.org/ns", "c").isSameNode(attr)
01116                 and attrmap["c"].isSameNode(attr)
01117                 and attrmap[("http://xml.python.org/ns", "c")].isSameNode(attr))
01118 
01119         # Rename to have a namespace, with prefix
01120         attr = doc.renameNode(attr, "http://xml.python.org/ns2", "p:d")
01121         self.confirm(attr.name == "p:d"
01122                 and attr.nodeName == "p:d"
01123                 and attr.localName == "d"
01124                 and attr.namespaceURI == "http://xml.python.org/ns2"
01125                 and attr.prefix == "p"
01126                 and attr.value == "v"
01127                 and elem.getAttributeNode("a") is None
01128                 and elem.getAttributeNode("b") is None
01129                 and elem.getAttributeNode("c") is None
01130                 and elem.getAttributeNodeNS(
01131                     "http://xml.python.org/ns", "c") is None
01132                 and elem.getAttributeNode("p:d").isSameNode(attr)
01133                 and elem.getAttributeNodeNS(
01134                     "http://xml.python.org/ns2", "d").isSameNode(attr)
01135                 and attrmap["p:d"].isSameNode(attr)
01136                 and attrmap[("http://xml.python.org/ns2", "d")].isSameNode(attr))
01137 
01138         # Rename back to a simple non-NS node
01139         attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "e")
01140         self.confirm(attr.name == "e"
01141                 and attr.nodeName == "e"
01142                 and attr.localName is None
01143                 and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE
01144                 and attr.prefix is None
01145                 and attr.value == "v"
01146                 and elem.getAttributeNode("a") is None
01147                 and elem.getAttributeNode("b") is None
01148                 and elem.getAttributeNode("c") is None
01149                 and elem.getAttributeNode("p:d") is None
01150                 and elem.getAttributeNodeNS(
01151                     "http://xml.python.org/ns", "c") is None
01152                 and elem.getAttributeNode("e").isSameNode(attr)
01153                 and attrmap["e"].isSameNode(attr))
01154 
01155         self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, attr,
01156                           "http://xml.python.org/ns", "xmlns")
01157         self.checkRenameNodeSharedConstraints(doc, attr)
01158         doc.unlink()

Here is the call graph for this function:

Definition at line 1159 of file test_minidom.py.

01159 
01160     def testRenameElement(self):
01161         doc = parseString("<doc/>")
01162         elem = doc.documentElement
01163 
01164         # Simple renaming
01165         elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "a")
01166         self.confirm(elem.tagName == "a"
01167                 and elem.nodeName == "a"
01168                 and elem.localName is None
01169                 and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE
01170                 and elem.prefix is None
01171                 and elem.ownerDocument.isSameNode(doc))
01172 
01173         # Rename to have a namespace, no prefix
01174         elem = doc.renameNode(elem, "http://xml.python.org/ns", "b")
01175         self.confirm(elem.tagName == "b"
01176                 and elem.nodeName == "b"
01177                 and elem.localName == "b"
01178                 and elem.namespaceURI == "http://xml.python.org/ns"
01179                 and elem.prefix is None
01180                 and elem.ownerDocument.isSameNode(doc))
01181 
01182         # Rename to have a namespace, with prefix
01183         elem = doc.renameNode(elem, "http://xml.python.org/ns2", "p:c")
01184         self.confirm(elem.tagName == "p:c"
01185                 and elem.nodeName == "p:c"
01186                 and elem.localName == "c"
01187                 and elem.namespaceURI == "http://xml.python.org/ns2"
01188                 and elem.prefix == "p"
01189                 and elem.ownerDocument.isSameNode(doc))
01190 
01191         # Rename back to a simple non-NS node
01192         elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "d")
01193         self.confirm(elem.tagName == "d"
01194                 and elem.nodeName == "d"
01195                 and elem.localName is None
01196                 and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE
01197                 and elem.prefix is None
01198                 and elem.ownerDocument.isSameNode(doc))
01199 
01200         self.checkRenameNodeSharedConstraints(doc, elem)
01201         doc.unlink()

Here is the call graph for this function:

Definition at line 1202 of file test_minidom.py.

01202 
01203     def testRenameOther(self):
01204         # We have to create a comment node explicitly since not all DOM
01205         # builders used with minidom add comments to the DOM.
01206         doc = xml.dom.minidom.getDOMImplementation().createDocument(
01207             xml.dom.EMPTY_NAMESPACE, "e", None)
01208         node = doc.createComment("comment")
01209         self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node,
01210                           xml.dom.EMPTY_NAMESPACE, "foo")
01211         doc.unlink()

Here is the call graph for this function:

Definition at line 156 of file test_minidom.py.

00156 
00157     def testReplaceChildFragment(self):
00158         dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
00159         dom.documentElement.replaceChild(frag, orig)
00160         orig.unlink()
00161         self.confirm(tuple(dom.documentElement.childNodes) == (c1, c2, c3),
00162                 "replaceChild(<fragment>)")
00163         frag.unlink()
00164         dom.unlink()

Here is the call graph for this function:

Definition at line 1257 of file test_minidom.py.

01257 
01258     def testReplaceWholeText(self):
01259         def setup():
01260             doc = parseString("<doc>a<e/>d</doc>")
01261             elem = doc.documentElement
01262             text1 = elem.firstChild
01263             text2 = elem.lastChild
01264             splitter = text1.nextSibling
01265             elem.insertBefore(doc.createTextNode("b"), splitter)
01266             elem.insertBefore(doc.createCDATASection("c"), text1)
01267             return doc, elem, text1, splitter, text2
01268 
01269         doc, elem, text1, splitter, text2 = setup()
01270         text = text1.replaceWholeText("new content")
01271         self.checkWholeText(text, "new content")
01272         self.checkWholeText(text2, "d")
01273         self.confirm(len(elem.childNodes) == 3)
01274 
01275         doc, elem, text1, splitter, text2 = setup()
01276         text = text2.replaceWholeText("new content")
01277         self.checkWholeText(text, "new content")
01278         self.checkWholeText(text1, "cab")
01279         self.confirm(len(elem.childNodes) == 5)
01280 
01281         doc, elem, text1, splitter, text2 = setup()
01282         text = text1.replaceWholeText("")
01283         self.checkWholeText(text2, "d")
01284         self.confirm(text is None
01285                 and len(elem.childNodes) == 2)

Here is the call graph for this function:

Definition at line 992 of file test_minidom.py.

00992 
00993     def testSAX2DOM(self):
00994         from xml.dom import pulldom
00995 
00996         sax2dom = pulldom.SAX2DOM()
00997         sax2dom.startDocument()
00998         sax2dom.startElement("doc", {})
00999         sax2dom.characters("text")
01000         sax2dom.startElement("subelm", {})
01001         sax2dom.characters("text")
01002         sax2dom.endElement("subelm")
01003         sax2dom.characters("text")
01004         sax2dom.endElement("doc")
01005         sax2dom.endDocument()
01006 
01007         doc = sax2dom.document
01008         root = doc.documentElement
01009         (text1, elm1, text2) = root.childNodes
01010         text3 = elm1.childNodes[0]
01011 
01012         self.confirm(text1.previousSibling is None and
01013                 text1.nextSibling is elm1 and
01014                 elm1.previousSibling is text1 and
01015                 elm1.nextSibling is text2 and
01016                 text2.previousSibling is elm1 and
01017                 text2.nextSibling is None and
01018                 text3.previousSibling is None and
01019                 text3.nextSibling is None, "testSAX2DOM - siblings")
01020 
01021         self.confirm(root.parentNode is doc and
01022                 text1.parentNode is root and
01023                 elm1.parentNode is root and
01024                 text2.parentNode is root and
01025                 text3.parentNode is elm1, "testSAX2DOM - parents")
01026         doc.unlink()

Here is the call graph for this function:

Definition at line 1286 of file test_minidom.py.

01286 
01287     def testSchemaType(self):
01288         doc = parseString(
01289             "<!DOCTYPE doc [\n"
01290             "  <!ENTITY e1 SYSTEM 'http://xml.python.org/e1'>\n"
01291             "  <!ENTITY e2 SYSTEM 'http://xml.python.org/e2'>\n"
01292             "  <!ATTLIST doc id   ID       #IMPLIED \n"
01293             "                ref  IDREF    #IMPLIED \n"
01294             "                refs IDREFS   #IMPLIED \n"
01295             "                enum (a|b)    #IMPLIED \n"
01296             "                ent  ENTITY   #IMPLIED \n"
01297             "                ents ENTITIES #IMPLIED \n"
01298             "                nm   NMTOKEN  #IMPLIED \n"
01299             "                nms  NMTOKENS #IMPLIED \n"
01300             "                text CDATA    #IMPLIED \n"
01301             "    >\n"
01302             "]><doc id='name' notid='name' text='splat!' enum='b'"
01303             "       ref='name' refs='name name' ent='e1' ents='e1 e2'"
01304             "       nm='123' nms='123 abc' />")
01305         elem = doc.documentElement
01306         # We don't want to rely on any specific loader at this point, so
01307         # just make sure we can get to all the names, and that the
01308         # DTD-based namespace is right.  The names can vary by loader
01309         # since each supports a different level of DTD information.
01310         t = elem.schemaType
01311         self.confirm(t.name is None
01312                 and t.namespace == xml.dom.EMPTY_NAMESPACE)
01313         names = "id notid text enum ref refs ent ents nm nms".split()
01314         for name in names:
01315             a = elem.getAttributeNode(name)
01316             t = a.schemaType
01317             self.confirm(hasattr(t, "name")
01318                     and t.namespace == xml.dom.EMPTY_NAMESPACE)

Here is the call graph for this function:

Definition at line 1468 of file test_minidom.py.

01468 
01469     def testSerializeCommentNodeWithDoubleHyphen(self):
01470         doc = create_doc_without_doctype()
01471         doc.appendChild(doc.createComment("foo--bar"))
01472         self.assertRaises(ValueError, doc.toxml)

Here is the call graph for this function:

Definition at line 527 of file test_minidom.py.

00527 
00528     def testSetAttrValueandNodeValue(self): pass

Definition at line 1319 of file test_minidom.py.

01319 
01320     def testSetIdAttribute(self):
01321         doc = parseString("<doc a1='v' a2='w'/>")
01322         e = doc.documentElement
01323         a1 = e.getAttributeNode("a1")
01324         a2 = e.getAttributeNode("a2")
01325         self.confirm(doc.getElementById("v") is None
01326                 and not a1.isId
01327                 and not a2.isId)
01328         e.setIdAttribute("a1")
01329         self.confirm(e.isSameNode(doc.getElementById("v"))
01330                 and a1.isId
01331                 and not a2.isId)
01332         e.setIdAttribute("a2")
01333         self.confirm(e.isSameNode(doc.getElementById("v"))
01334                 and e.isSameNode(doc.getElementById("w"))
01335                 and a1.isId
01336                 and a2.isId)
01337         # replace the a1 node; the new node should *not* be an ID
01338         a3 = doc.createAttribute("a1")
01339         a3.value = "v"
01340         e.setAttributeNode(a3)
01341         self.confirm(doc.getElementById("v") is None
01342                 and e.isSameNode(doc.getElementById("w"))
01343                 and not a1.isId
01344                 and a2.isId
01345                 and not a3.isId)
01346         # renaming an attribute should not affect its ID-ness:
01347         doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
01348         self.confirm(e.isSameNode(doc.getElementById("w"))
01349                 and a2.isId)

Here is the call graph for this function:

Definition at line 1386 of file test_minidom.py.

01386 
01387     def testSetIdAttributeNode(self):
01388         NS1 = "http://xml.python.org/ns1"
01389         NS2 = "http://xml.python.org/ns2"
01390         doc = parseString("<doc"
01391                           " xmlns:ns1='" + NS1 + "'"
01392                           " xmlns:ns2='" + NS2 + "'"
01393                           " ns1:a1='v' ns2:a2='w'/>")
01394         e = doc.documentElement
01395         a1 = e.getAttributeNodeNS(NS1, "a1")
01396         a2 = e.getAttributeNodeNS(NS2, "a2")
01397         self.confirm(doc.getElementById("v") is None
01398                 and not a1.isId
01399                 and not a2.isId)
01400         e.setIdAttributeNode(a1)
01401         self.confirm(e.isSameNode(doc.getElementById("v"))
01402                 and a1.isId
01403                 and not a2.isId)
01404         e.setIdAttributeNode(a2)
01405         self.confirm(e.isSameNode(doc.getElementById("v"))
01406                 and e.isSameNode(doc.getElementById("w"))
01407                 and a1.isId
01408                 and a2.isId)
01409         # replace the a1 node; the new node should *not* be an ID
01410         a3 = doc.createAttributeNS(NS1, "a1")
01411         a3.value = "v"
01412         e.setAttributeNode(a3)
01413         self.confirm(e.isSameNode(doc.getElementById("w")))
01414         self.confirm(not a1.isId)
01415         self.confirm(a2.isId)
01416         self.confirm(not a3.isId)
01417         self.confirm(doc.getElementById("v") is None)
01418         # renaming an attribute should not affect its ID-ness:
01419         doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
01420         self.confirm(e.isSameNode(doc.getElementById("w"))
01421                 and a2.isId)

Here is the call graph for this function:

Definition at line 1350 of file test_minidom.py.

01350 
01351     def testSetIdAttributeNS(self):
01352         NS1 = "http://xml.python.org/ns1"
01353         NS2 = "http://xml.python.org/ns2"
01354         doc = parseString("<doc"
01355                           " xmlns:ns1='" + NS1 + "'"
01356                           " xmlns:ns2='" + NS2 + "'"
01357                           " ns1:a1='v' ns2:a2='w'/>")
01358         e = doc.documentElement
01359         a1 = e.getAttributeNodeNS(NS1, "a1")
01360         a2 = e.getAttributeNodeNS(NS2, "a2")
01361         self.confirm(doc.getElementById("v") is None
01362                 and not a1.isId
01363                 and not a2.isId)
01364         e.setIdAttributeNS(NS1, "a1")
01365         self.confirm(e.isSameNode(doc.getElementById("v"))
01366                 and a1.isId
01367                 and not a2.isId)
01368         e.setIdAttributeNS(NS2, "a2")
01369         self.confirm(e.isSameNode(doc.getElementById("v"))
01370                 and e.isSameNode(doc.getElementById("w"))
01371                 and a1.isId
01372                 and a2.isId)
01373         # replace the a1 node; the new node should *not* be an ID
01374         a3 = doc.createAttributeNS(NS1, "a1")
01375         a3.value = "v"
01376         e.setAttributeNode(a3)
01377         self.confirm(e.isSameNode(doc.getElementById("w")))
01378         self.confirm(not a1.isId)
01379         self.confirm(a2.isId)
01380         self.confirm(not a3.isId)
01381         self.confirm(doc.getElementById("v") is None)
01382         # renaming an attribute should not affect its ID-ness:
01383         doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
01384         self.confirm(e.isSameNode(doc.getElementById("w"))
01385                 and a2.isId)

Here is the call graph for this function:

Definition at line 951 of file test_minidom.py.

00951 
00952     def testSiblings(self):
00953         doc = parseString("<doc><?pi?>text?<elm/></doc>")
00954         root = doc.documentElement
00955         (pi, text, elm) = root.childNodes
00956 
00957         self.confirm(pi.nextSibling is text and
00958                 pi.previousSibling is None and
00959                 text.nextSibling is elm and
00960                 text.previousSibling is pi and
00961                 elm.nextSibling is None and
00962                 elm.previousSibling is text, "testSiblings")
00963 
00964         doc.unlink()

Here is the call graph for this function:

Definition at line 433 of file test_minidom.py.

00433 
00434     def testTextNodeRepr(self): pass

Definition at line 466 of file test_minidom.py.

00466 
00467     def testTextRepr(self): pass

Definition at line 472 of file test_minidom.py.

00472 
00473     def testTooManyDocumentElements(self):
00474         doc = parseString("<doc/>")
00475         elem = doc.createElement("extra")
00476         # Should raise an exception when adding an extra document element.
00477         self.assertRaises(xml.dom.HierarchyRequestErr, doc.appendChild, elem)
00478         elem.unlink()
00479         doc.unlink()

Here is the call graph for this function:

Definition at line 210 of file test_minidom.py.

00210 
00211     def testUnlink(self):
00212         dom = parse(tstfile)
00213         self.assertTrue(dom.childNodes)
00214         dom.unlink()
00215         self.assertFalse(dom.childNodes)

Here is the call graph for this function:

Definition at line 1050 of file test_minidom.py.

01050 
01051     def testUserData(self):
01052         dom = Document()
01053         n = dom.createElement('e')
01054         self.confirm(n.getUserData("foo") is None)
01055         n.setUserData("foo", None, None)
01056         self.confirm(n.getUserData("foo") is None)
01057         n.setUserData("foo", 12, 12)
01058         n.setUserData("bar", 13, 13)
01059         self.confirm(n.getUserData("foo") == 12)
01060         self.confirm(n.getUserData("bar") == 13)
01061         n.setUserData("foo", None, None)
01062         self.confirm(n.getUserData("foo") is None)
01063         self.confirm(n.getUserData("bar") == 13)
01064 
01065         handler = self.UserDataHandler()
01066         n.setUserData("bar", 12, handler)
01067         c = n.cloneNode(1)
01068         self.confirm(handler.called
01069                 and n.getUserData("bar") is None
01070                 and c.getUserData("bar") == 13)
01071         n.unlink()
01072         c.unlink()
01073         dom.unlink()

Here is the call graph for this function:

Definition at line 1212 of file test_minidom.py.

01212 
01213     def testWholeText(self):
01214         doc = parseString("<doc>a</doc>")
01215         elem = doc.documentElement
01216         text = elem.childNodes[0]
01217         self.assertEqual(text.nodeType, Node.TEXT_NODE)
01218 
01219         self.checkWholeText(text, "a")
01220         elem.appendChild(doc.createTextNode("b"))
01221         self.checkWholeText(text, "ab")
01222         elem.insertBefore(doc.createCDATASection("c"), text)
01223         self.checkWholeText(text, "cab")
01224 
01225         # make sure we don't cross other nodes
01226         splitter = doc.createComment("comment")
01227         elem.appendChild(splitter)
01228         text2 = doc.createTextNode("d")
01229         elem.appendChild(text2)
01230         self.checkWholeText(text, "cab")
01231         self.checkWholeText(text2, "d")
01232 
01233         x = doc.createElement("x")
01234         elem.replaceChild(x, splitter)
01235         splitter = x
01236         self.checkWholeText(text, "cab")
01237         self.checkWholeText(text2, "d")
01238 
01239         x = doc.createProcessingInstruction("y", "z")
01240         elem.replaceChild(x, splitter)
01241         splitter = x
01242         self.checkWholeText(text, "cab")
01243         self.checkWholeText(text2, "d")
01244 
01245         elem.removeChild(splitter)
01246         self.checkWholeText(text, "cabd")
01247         self.checkWholeText(text2, "cabd")

Here is the call graph for this function:

Definition at line 468 of file test_minidom.py.

00468 
00469     def testWriteText(self): pass

Definition at line 435 of file test_minidom.py.

00435 
00436     def testWriteXML(self):
00437         str = '<?xml version="1.0" ?><a b="c"/>'
00438         dom = parseString(str)
00439         domstr = dom.toxml()
00440         dom.unlink()
00441         self.confirm(str == domstr)

Here is the call graph for this function:


The documentation for this class was generated from the following file: