summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2000-12-31 04:03:27 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2000-12-31 04:03:27 (GMT)
commitad4a558af861dd072ef3d668349a882392700d87 (patch)
tree2858974f4b4a14105e045712fa7d43a2adbd8c29
parent291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 (diff)
downloadcpython-ad4a558af861dd072ef3d668349a882392700d87.zip
cpython-ad4a558af861dd072ef3d668349a882392700d87.tar.gz
cpython-ad4a558af861dd072ef3d668349a882392700d87.tar.bz2
Added test case for legal DOM children
-rw-r--r--Lib/test/output/test_minidom4
-rw-r--r--Lib/test/test_minidom.py26
2 files changed, 28 insertions, 2 deletions
diff --git a/Lib/test/output/test_minidom b/Lib/test/output/test_minidom
index 82cab3e..b0cb932 100644
--- a/Lib/test/output/test_minidom
+++ b/Lib/test/output/test_minidom
@@ -76,7 +76,7 @@ Test Succeeded testClonePIShallow
Passed assertion: len(Node.allnodes) == 0
Test Succeeded testComment
Passed assertion: len(Node.allnodes) == 0
-Test Succeeded testCreatAttributeNS
+Test Succeeded testCreateAttributeNS
Passed assertion: len(Node.allnodes) == 0
Test Succeeded testCreateElementNS
Passed assertion: len(Node.allnodes) == 0
@@ -121,6 +121,8 @@ Passed testInsertBefore -- node properly placed in tree
Passed testInsertBefore -- node properly placed in tree
Test Succeeded testInsertBefore
Passed assertion: len(Node.allnodes) == 0
+Test Succeeded testLegalChildren
+Passed assertion: len(Node.allnodes) == 0
Passed Test
Passed Test
Test Succeeded testNonZero
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index dbdd25e..32bf385 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -76,6 +76,30 @@ def testAppendChild():
confirm(dom.documentElement.childNodes[-1].data == "Hello")
dom.unlink()
+def testLegalChildren():
+ dom = Document()
+ elem = dom.createElement('element')
+ text = dom.createTextNode('text')
+
+ try: dom.appendChild(text)
+ except HierarchyRequestErr: pass
+ else:
+ print "dom.appendChild didn't raise HierarchyRequestErr"
+
+ dom.appendChild(elem)
+ try: dom.insertBefore(text, elem)
+ except HierarchyRequestErr: pass
+ else:
+ print "dom.appendChild didn't raise HierarchyRequestErr"
+
+ try: dom.replaceChild(text, elem)
+ except HierarchyRequestErr: pass
+ else:
+ print "dom.appendChild didn't raise HierarchyRequestErr"
+
+ elem.appendChild(text)
+ dom.unlink()
+
def testNonZero():
dom = parse(tstfile)
confirm(dom)# should not be zero
@@ -279,7 +303,7 @@ def testTooManyDocumentElements():
def testCreateElementNS(): pass
-def testCreatAttributeNS(): pass
+def testCreateAttributeNS(): pass
def testParse(): pass