8000 gh-63882: Adds tests for xml.dom.minidom by karlcow · Pull Request #24152 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-63882: Adds tests for xml.dom.minidom #24152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 21 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
afefc8a
bpo-19683: Changes the docstring for the test file
karlcow Jan 7, 2021
24fd486
bpo-19683: Adds tests for toxml method
karlcow Jan 7, 2021
172eacd
bpo-19683: Changes the _repr_ for Node Element
karlcow Jan 7, 2021
0d60669
bpo-19683: Reorganize import for clarity
karlcow Jan 7, 2021
c106ce5
bpo-19683: Adds encoding test for toxml
karlcow Jan 7, 2021
847c6f2
bpo-19683: Reformats hasChildNodes test
karlcow Jan 7, 2021
c488947
bpo-19683: Adds test for childNodes
karlcow Jan 7, 2021
dc3f100
bpo-19683: Adds firstChild and lastChild tests
karlcow Jan 7, 2021
14ad87c
bpo-19683: Adds test for insertBefore DocumentFragment
karlcow Jan 11, 2021
a009350
bpo-19683: Adds test for insertBefore for invalid NodeType
karlcow Jan 15, 2021
709a640
bpo-19683: Adds test for insertBefore for text node
karlcow Jan 15, 2021
b6fe778
bpo-19683: Adds test for insertBefore without ref node
karlcow Jan 15, 2021
95aafaf
bpo-19683: Adds tests for insertBefore
karlcow Jan 19, 2021
896543e
bpo-19683: Adds tests for appendChild
karlcow Jan 19, 2021
4dc05ca
bpo-19683: Removes tests which are empty
karlcow Jan 19, 2021
ff99b90
bpo-19683: Adds tests firstChild, lastChild
karlcow Jan 19, 2021
e5654e8
bpo-19683: Adds tests for replaceChild to xml.dom.test_minidom
karlcow Jan 19, 2021
0da118b
bpo-19683: Adds tests for removeChild
karlcow Jan 19, 2021
d0d51f2
bpo-19683: Adds tests for normalize. Part 1
karlcow Feb 19, 2021
52c26c5
bpo-19683: Adds tests for normalize. Part 2
karlcow Feb 19, 2021
c8ef460
bpo-19683: Adds cloneNode tests. Part 1
karlcow Feb 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bpo-19683: Adds test for childNodes
  • Loading branch information
karlcow committed Jan 7, 2021
commit c4889477c6b607d40925a8337dd1a089bf3d4674
13 changes: 11 additions & 2 deletions Lib/test/test_minidom.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
from test import support
import unittest

from xml.dom.minicompat import NodeList
import xml.dom.minidom
from xml.dom.minidom import Document
from xml.dom.minidom import Element
from xml.dom.minidom import getDOMImplementation
from xml.dom.minidom import Node
from xml.dom.minidom import parse
Expand Down Expand Up @@ -622,8 +624,6 @@ def testParseAttributeNamespaces(self): pass

def testParseProcessingInstructions(self): pass

def testChildNodes(self): pass

def testFirstChild(self): pass

def _testCloneElementCopiesAttributes(self, e1, e2, test):
Expand Down Expand Up @@ -1679,5 +1679,14 @@ def test_hasChildNodes(self):
dom2 = parseString("<doc/>")
doc2 = dom2.documentElement
self.assertFalse(doc2.hasChildNodes())

def test_childNodes(self):
"""Test the list of children Nodes of a DOM Element."""
dom = parseString('<div><img/><hr/></div>')
doc = dom.documentElement
self.assertEqual(len(doc.childNodes), 2)
self.assertIsInstance(doc.childNodes[0], Element)
self.assertIsInstance(doc.childNodes, NodeList)

if __name__ == "__main__":
unittest.main()
0