Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
946f7b1b
Commit
946f7b1b
authored
Sep 28, 2001
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the xml.dom.minidom tests to cover the DOM-compliant parts of the
NodeList interface.
parent
76d62b4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
Lib/test/output/test_minidom
Lib/test/output/test_minidom
+3
-0
Lib/test/test_minidom.py
Lib/test/test_minidom.py
+28
-2
No files found.
Lib/test/output/test_minidom
View file @
946f7b1b
...
@@ -124,6 +124,9 @@ Test Succeeded testInsertBefore
...
@@ -124,6 +124,9 @@ Test Succeeded testInsertBefore
Passed assertion: len(Node.allnodes) == 0
Passed assertion: len(Node.allnodes) == 0
Test Succeeded testLegalChildren
Test Succeeded testLegalChildren
Passed assertion: len(Node.allnodes) == 0
Passed assertion: len(Node.allnodes) == 0
Passed test NodeList.item()
Test Succeeded testNodeListItem
Passed assertion: len(Node.allnodes) == 0
Passed Test
Passed Test
Passed Test
Passed Test
Test Succeeded testNonZero
Test Succeeded testNonZero
...
...
Lib/test/test_minidom.py
View file @
946f7b1b
...
@@ -44,8 +44,11 @@ def testInsertBefore():
...
@@ -44,8 +44,11 @@ def testInsertBefore():
nelem
=
dom
.
createElement
(
"element"
)
nelem
=
dom
.
createElement
(
"element"
)
root
.
insertBefore
(
nelem
,
elem
)
root
.
insertBefore
(
nelem
,
elem
)
confirm
(
len
(
root
.
childNodes
)
==
2
confirm
(
len
(
root
.
childNodes
)
==
2
and
root
.
childNodes
.
length
==
2
and
root
.
childNodes
[
0
]
is
nelem
and
root
.
childNodes
[
0
]
is
nelem
and
root
.
childNodes
.
item
(
0
)
is
nelem
and
root
.
childNodes
[
1
]
is
elem
and
root
.
childNodes
[
1
]
is
elem
and
root
.
childNodes
.
item
(
1
)
is
elem
and
root
.
firstChild
is
nelem
and
root
.
firstChild
is
nelem
and
root
.
lastChild
is
elem
and
root
.
lastChild
is
elem
and
root
.
toxml
()
==
"<doc><element/><foo/></doc>"
and
root
.
toxml
()
==
"<doc><element/><foo/></doc>"
...
@@ -53,8 +56,11 @@ def testInsertBefore():
...
@@ -53,8 +56,11 @@ def testInsertBefore():
nelem
=
dom
.
createElement
(
"element"
)
nelem
=
dom
.
createElement
(
"element"
)
root
.
insertBefore
(
nelem
,
None
)
root
.
insertBefore
(
nelem
,
None
)
confirm
(
len
(
root
.
childNodes
)
==
3
confirm
(
len
(
root
.
childNodes
)
==
3
and
root
.
childNodes
.
length
==
3
and
root
.
childNodes
[
1
]
is
elem
and
root
.
childNodes
[
1
]
is
elem
and
root
.
childNodes
.
item
(
1
)
is
elem
and
root
.
childNodes
[
2
]
is
nelem
and
root
.
childNodes
[
2
]
is
nelem
and
root
.
childNodes
.
item
(
2
)
is
nelem
and
root
.
lastChild
is
nelem
and
root
.
lastChild
is
nelem
and
nelem
.
previousSibling
is
elem
and
nelem
.
previousSibling
is
elem
and
root
.
toxml
()
==
"<doc><element/><foo/><element/></doc>"
and
root
.
toxml
()
==
"<doc><element/><foo/><element/></doc>"
...
@@ -62,8 +68,11 @@ def testInsertBefore():
...
@@ -62,8 +68,11 @@ def testInsertBefore():
nelem2
=
dom
.
createElement
(
"bar"
)
nelem2
=
dom
.
createElement
(
"bar"
)
root
.
insertBefore
(
nelem2
,
nelem
)
root
.
insertBefore
(
nelem2
,
nelem
)
confirm
(
len
(
root
.
childNodes
)
==
4
confirm
(
len
(
root
.
childNodes
)
==
4
and
root
.
childNodes
.
length
==
4
and
root
.
childNodes
[
2
]
is
nelem2
and
root
.
childNodes
[
2
]
is
nelem2
and
root
.
childNodes
.
item
(
2
)
is
nelem2
and
root
.
childNodes
[
3
]
is
nelem
and
root
.
childNodes
[
3
]
is
nelem
and
root
.
childNodes
.
item
(
3
)
is
nelem
and
nelem2
.
nextSibling
is
nelem
and
nelem2
.
nextSibling
is
nelem
and
nelem
.
previousSibling
is
nelem2
and
nelem
.
previousSibling
is
nelem2
and
root
.
toxml
()
==
"<doc><element/><foo/><bar/><element/></doc>"
and
root
.
toxml
()
==
"<doc><element/><foo/><bar/><element/></doc>"
...
@@ -369,6 +378,7 @@ def testHasChildNodes(): pass
...
@@ -369,6 +378,7 @@ def testHasChildNodes(): pass
def
testCloneElementShallow
():
def
testCloneElementShallow
():
dom
,
clone
=
_setupCloneElement
(
0
)
dom
,
clone
=
_setupCloneElement
(
0
)
confirm
(
len
(
clone
.
childNodes
)
==
0
confirm
(
len
(
clone
.
childNodes
)
==
0
and
clone
.
childNodes
.
length
==
0
and
clone
.
parentNode
is
None
and
clone
.
parentNode
is
None
and
clone
.
toxml
()
==
'<doc attr="value"/>'
and
clone
.
toxml
()
==
'<doc attr="value"/>'
,
"testCloneElementShallow"
)
,
"testCloneElementShallow"
)
...
@@ -377,6 +387,7 @@ def testCloneElementShallow():
...
@@ -377,6 +387,7 @@ def testCloneElementShallow():
def
testCloneElementDeep
():
def
testCloneElementDeep
():
dom
,
clone
=
_setupCloneElement
(
1
)
dom
,
clone
=
_setupCloneElement
(
1
)
confirm
(
len
(
clone
.
childNodes
)
==
1
confirm
(
len
(
clone
.
childNodes
)
==
1
and
clone
.
childNodes
.
length
==
1
and
clone
.
parentNode
is
None
and
clone
.
parentNode
is
None
and
clone
.
toxml
()
==
'<doc attr="value"><foo/></doc>'
and
clone
.
toxml
()
==
'<doc attr="value"><foo/></doc>'
,
"testCloneElementDeep"
)
,
"testCloneElementDeep"
)
...
@@ -432,9 +443,11 @@ def testNormalize():
...
@@ -432,9 +443,11 @@ def testNormalize():
root
=
doc
.
documentElement
root
=
doc
.
documentElement
root
.
appendChild
(
doc
.
createTextNode
(
"first"
))
root
.
appendChild
(
doc
.
createTextNode
(
"first"
))
root
.
appendChild
(
doc
.
createTextNode
(
"second"
))
root
.
appendChild
(
doc
.
createTextNode
(
"second"
))
confirm
(
len
(
root
.
childNodes
)
==
2
,
"testNormalize -- preparation"
)
confirm
(
len
(
root
.
childNodes
)
==
2
and
root
.
childNodes
.
length
==
2
,
"testNormalize -- preparation"
)
doc
.
normalize
()
doc
.
normalize
()
confirm
(
len
(
root
.
childNodes
)
==
1
confirm
(
len
(
root
.
childNodes
)
==
1
and
root
.
childNodes
.
length
==
1
and
root
.
firstChild
is
root
.
lastChild
and
root
.
firstChild
is
root
.
lastChild
and
root
.
firstChild
.
data
==
"firstsecond"
and
root
.
firstChild
.
data
==
"firstsecond"
,
"testNormalize -- result"
)
,
"testNormalize -- result"
)
...
@@ -444,7 +457,8 @@ def testNormalize():
...
@@ -444,7 +457,8 @@ def testNormalize():
root
=
doc
.
documentElement
root
=
doc
.
documentElement
root
.
appendChild
(
doc
.
createTextNode
(
""
))
root
.
appendChild
(
doc
.
createTextNode
(
""
))
doc
.
normalize
()
doc
.
normalize
()
confirm
(
len
(
root
.
childNodes
)
==
0
,
confirm
(
len
(
root
.
childNodes
)
==
0
and
root
.
childNodes
.
length
==
0
,
"testNormalize -- single empty node removed"
)
"testNormalize -- single empty node removed"
)
doc
.
unlink
()
doc
.
unlink
()
...
@@ -477,6 +491,18 @@ def testParents():
...
@@ -477,6 +491,18 @@ def testParents():
doc
.
unlink
()
doc
.
unlink
()
def
testNodeListItem
():
doc
=
parseString
(
"<doc><e/><e/></doc>"
)
children
=
doc
.
childNodes
docelem
=
children
[
0
]
confirm
(
children
[
0
]
is
children
.
item
(
0
)
and
children
.
item
(
1
)
is
None
and
docelem
.
childNodes
.
item
(
0
)
is
docelem
.
childNodes
[
0
]
and
docelem
.
childNodes
.
item
(
1
)
is
docelem
.
childNodes
[
1
]
and
docelem
.
childNodes
.
item
(
0
).
childNodes
.
item
(
0
)
is
None
,
"test NodeList.item()"
)
doc
.
unlink
()
def
testSAX2DOM
():
def
testSAX2DOM
():
from
xml.dom
import
pulldom
from
xml.dom
import
pulldom
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment