summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_minidom.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-07-19 22:16:41 (GMT)
committerFred Drake <fdrake@acm.org>2002-07-19 22:16:41 (GMT)
commitc441f7b3a6f06e442a08646f857b2c7b5f3018a0 (patch)
tree6a382a6c50068088e6754dfdfcdd1a71a45f1478 /Lib/test/test_minidom.py
parent814f9fe806c35899b80d84871ab903860c7f5bdb (diff)
downloadcpython-c441f7b3a6f06e442a08646f857b2c7b5f3018a0.zip
cpython-c441f7b3a6f06e442a08646f857b2c7b5f3018a0.tar.gz
cpython-c441f7b3a6f06e442a08646f857b2c7b5f3018a0.tar.bz2
Follow PyXML: Remove all prints from successful tests. This means we can
also drop the output file.
Diffstat (limited to 'Lib/test/test_minidom.py')
-rw-r--r--Lib/test/test_minidom.py35
1 files changed, 14 insertions, 21 deletions
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index d398d73..ac5b04c 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -1,14 +1,16 @@
# test for xml.dom.minidom
-from xml.dom.minidom import parse, Node, Document, parseString
-from xml.dom import HierarchyRequestErr
-import xml.parsers.expat
-
import os
import sys
import traceback
+
from test_support import verbose
+import xml.dom
+import xml.parsers.expat
+
+from xml.dom.minidom import parse, Node, Document, parseString
+
if __name__ == "__main__":
base = sys.argv[0]
else:
@@ -17,9 +19,7 @@ tstfile = os.path.join(os.path.dirname(base), "test"+os.extsep+"xml")
del base
def confirm(test, testname = "Test"):
- if test:
- print "Passed " + testname
- else:
+ if not test:
print "Failed " + testname
raise Exception
@@ -137,29 +137,29 @@ def testLegalChildren():
text = dom.createTextNode('text')
try: dom.appendChild(text)
- except HierarchyRequestErr: pass
+ except xml.dom.HierarchyRequestErr: pass
else:
print "dom.appendChild didn't raise HierarchyRequestErr"
dom.appendChild(elem)
try: dom.insertBefore(text, elem)
- except HierarchyRequestErr: pass
+ except xml.dom.HierarchyRequestErr: pass
else:
print "dom.appendChild didn't raise HierarchyRequestErr"
try: dom.replaceChild(text, elem)
- except HierarchyRequestErr: pass
+ except xml.dom.HierarchyRequestErr: pass
else:
print "dom.appendChild didn't raise HierarchyRequestErr"
nodemap = elem.attributes
try: nodemap.setNamedItem(text)
- except HierarchyRequestErr: pass
+ except xml.dom.HierarchyRequestErr: pass
else:
print "NamedNodeMap.setNamedItem didn't raise HierarchyRequestErr"
try: nodemap.setNamedItemNS(text)
- except HierarchyRequestErr: pass
+ except xml.dom.HierarchyRequestErr: pass
else:
print "NamedNodeMap.setNamedItemNS didn't raise HierarchyRequestErr"
@@ -388,8 +388,8 @@ def testTooManyDocumentElements():
elem = doc.createElement("extra")
try:
doc.appendChild(elem)
- except HierarchyRequestErr:
- print "Caught expected exception when adding extra document element."
+ except xml.dom.HierarchyRequestErr:
+ pass
else:
print "Failed to catch expected exception when" \
" adding extra document element."
@@ -626,7 +626,6 @@ for name in names:
func = globals()[name]
try:
func()
- print "Test Succeeded", name
confirm(len(Node.allnodes) == 0,
"assertion: len(Node.allnodes) == 0")
if len(Node.allnodes):
@@ -650,9 +649,3 @@ if failed:
print "\n\n\n**** Check for failures in these tests:"
for name in failed:
print " " + name
- print
-else:
- print "All tests succeeded"
-
-Node.debug = None # Delete debug output collected in a StringIO object
-Node._debug = 0 # And reset debug mode