Commits

Fred Drake  committed 7d0af4e

Move the test for confirmation that all nodes have been freed into the
driver code, so that each test gets this; it had been done inconsistently.
Remove the lines that set the variables holding dom objects to None; not
needed since the interpreter cleans up locals on function return.

  • Participants
  • Parent commits 0c0e909
  • Branches legacy-trunk

Comments (0)

Files changed (2)

File Lib/test/output/test_minidom

 test_minidom
 Test Succeeded testAAA
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testAAB
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Passed Test
 Passed Test
 Passed Test
 Passed Test
 Test Succeeded testAddAttr
-Passed Test
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Passed Test
 Test Succeeded testAppendChild
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testAttrListItem
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testAttrListItemNS
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testAttrListItems
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testAttrListKeys
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testAttrListKeysNS
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testAttrListLength
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testAttrListValues
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testAttrList__getitem__
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testAttrList__setitem__
+Passed assertion: len(Node.allnodes) == 0
+Passed Test
 Passed Test
 Test Succeeded testAttributeRepr
-Passed Test
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Passed Test
 Passed Test
 Passed Test
 Passed Test
 Test Succeeded testChangeAttr
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testChildNodes
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testCloneAttributeDeep
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testCloneAttributeShallow
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testCloneDocumentDeep
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testCloneDocumentShallow
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testCloneElementDeep
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testCloneElementShallow
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testCloneElementShallowCopiesAttributes
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testClonePIDeep
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testClonePIShallow
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testComment
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testCreatAttributeNS
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testCreateElementNS
-Passed Test
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Passed Test
 Passed Test
 Test Succeeded testDeleteAttr
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testDocumentElement
-Passed Test
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Test Succeeded testElement
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Test Succeeded testElementReprAndStr
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testFirstChild
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testGetAttrLength
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testGetAttrList
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testGetAttrValues
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testGetAttribute
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testGetAttributeNS
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testGetAttributeNode
-Passed Test
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Test Succeeded testGetElementsByTagName
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testGetElementsByTagNameNS
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testGetEmptyNodeListFromElementsByTagNameNS
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testHasChildNodes
-Passed Test
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testInsertBefore
-Passed Test
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Passed Test
 Test Succeeded testNonZero
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testParse
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testParseAttributeNamespaces
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testParseAttributes
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testParseElement
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testParseElementNamespaces
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Test Succeeded testParseFromFile
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testParseProcessingInstructions
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testParseString
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testProcessingInstruction
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testProcessingInstructionRepr
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Passed Test
 Test Succeeded testRemoveAttr
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Passed Test
 Test Succeeded testRemoveAttrNS
-Passed Test
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
 Passed Test
 Test Succeeded testRemoveAttributeNode
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testSetAttrValueandNodeValue
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testTextNodeRepr
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testTextRepr
+Passed assertion: len(Node.allnodes) == 0
 Test Succeeded testTooManyDocumentElements
+Passed assertion: len(Node.allnodes) == 0
+Test Succeeded testUnlink
+Passed assertion: len(Node.allnodes) == 0
+Test Succeeded testWriteText
+Passed assertion: len(Node.allnodes) == 0
 Passed Test
-Test Succeeded testUnlink
-Test Succeeded testWriteText
 Passed Test
 Test Succeeded testWriteXML
+Passed assertion: len(Node.allnodes) == 0
 All tests succeeded

File Lib/test/test_minidom.py

     confirm( dom.getElementsByTagName( "LI" )==\
             dom.documentElement.getElementsByTagName( "LI" ) )
     dom.unlink()
-    dom=None
-    confirm (len( Node.allnodes )==0)
 
 def testInsertBefore( ):
     dom=parse( tstfile )
     #confirm( docel.childNodes[0].tet=="a" )
     #confirm( docel.childNodes[2].tet=="a" )
     dom.unlink()
-    del dom
-    del docel
-    confirm( len( Node.allnodes )==0)
 
 def testAppendChild():
     dom=parse( tstfile )
     confirm( dom.documentElement.childNodes[-1].nodeName=="#comment" )
     confirm( dom.documentElement.childNodes[-1].data=="Hello" )
     dom.unlink()
-    dom=None
-    confirm( len( Node.allnodes )==0 )
 
 def testNonZero():
     dom=parse( tstfile )
     dom.appendChild( dom.createComment( "foo" ) )
     confirm( not dom.childNodes[-1].childNodes )
     dom.unlink()
-    dom=None
-    confirm( len( Node.allnodes )==0 )
 
 def testUnlink():
     dom=parse( tstfile )
     dom.unlink()
-    dom=None
-    confirm( len( Node.allnodes )==0 )
 
 def testElement():
     dom=Document()
     dom.appendChild( dom.createElement( "abc" ) )
     confirm( dom.documentElement )
     dom.unlink()
-    dom=None
-    confirm( len( Node.allnodes )==0 )
 
 def testAAA():
     dom=parseString( "<abc/>" )
     el=dom.documentElement
     el.setAttribute( "spam", "jam2" )
     dom.unlink()
-    dom=None
 
 def testAAB():
     dom=parseString( "<abc/>" )
     el.setAttribute( "spam", "jam" )
     el.setAttribute( "spam", "jam2" )
     dom.unlink()
-    dom=None
 
 def testAddAttr():
     dom=Document()
     confirm( child.attributes["def"].value=="newval" )
 
     confirm( len( child.attributes )==2 )
-
     dom.unlink()
-    dom=None
-    child=None
 
 def testDeleteAttr():
     dom=Document()
     del child.attributes["def"]
     confirm( len( child.attributes)==0 )
     dom.unlink()
-    confirm( len( Node.allnodes )==0 )
 
 def testRemoveAttr():
     dom=Document()
     confirm( len( child.attributes )==1 )
 
     dom.unlink()
-    dom=None
     
 def testRemoveAttributeNode():
     dom=Document()
     confirm( len( child.attributes )==0 )
 
     dom.unlink()
-    dom=None
-    confirm( len( Node.allnodes )==0 )
 
 def testChangeAttr():
     dom=parseString( "<abc/>" )
     el.attributes[ "spam2"]= "bam2"
     confirm( len( el.attributes )==2 )
     dom.unlink()
-    dom=None
-    confirm( len( Node.allnodes )==0 )
 
 def testGetAttrList():
     pass
     confirm( string1==string2 )
     confirm( string1.find("slash:abc" )!=-1 )
     dom.unlink()
+    confirm( len( Node.allnodes )==0 )
 
 def testAttributeRepr():
     dom=Document()
     node=el.setAttribute( "abc", "def" )
     confirm( str( node ) == repr( node ) )
     dom.unlink()
+    confirm( len( Node.allnodes )==0 )
 
 def testTextNodeRepr(): pass
 
     domstr = dom.toxml()
     dom.unlink()
     confirm(str == domstr)
+    confirm( len( Node.allnodes )==0 )
 
 def testProcessingInstruction(): pass
 
         try:
             func()
             print "Test Succeeded", name
+            confirm(len(Node.allnodes) == 0,
+                    "assertion: len(Node.allnodes) == 0")
             if len( Node.allnodes ):
                 print "Garbage left over:"
                 if verbose: