summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_minidom.py
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 /Lib/test/test_minidom.py
parent291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 (diff)
downloadcpython-ad4a558af861dd072ef3d668349a882392700d87.zip
cpython-ad4a558af861dd072ef3d668349a882392700d87.tar.gz
cpython-ad4a558af861dd072ef3d668349a882392700d87.tar.bz2
Added test case for legal DOM children
Diffstat (limited to 'Lib/test/test_minidom.py')
-rw-r--r--Lib/test/test_minidom.py26
1 files changed, 25 insertions, 1 deletions
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