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: Changes the _repr_ for Node Element
id in the _repr_ method doesn't seem that useful
when sending back a NodeList
Adds also docstrings to some methods.
  • Loading branch information
karlcow committed Jan 7, 2021
commit 172eacd959aac38e11249e8ff6c2253261c82984
5 changes: 4 additions & 1 deletion Lib/xml/dom/minidom.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@


class Node(xml.dom.Node):
"""Define properties accessible on a DOM node."""
namespaceURI = None # this is non-null only for elements and attributes
parentNode = None
ownerDocument = None
Expand All @@ -44,6 +45,7 @@ def __bool__(self):
return True

def toxml(self, encoding=None, standalone=None):
"""Generate a string representation of a DOM."""
return self.toprettyxml("", "", encoding, standalone)

def toprettyxml(self, indent="\t", newl="\n", encoding=None,
Expand All @@ -66,6 +68,7 @@ def toprettyxml(self, indent="\t", newl="\n", encoding=None,
return writer.detach().getvalue()

def hasChildNodes(self):
"""Return True if the node has children, False else."""
return bool(self.childNodes)

def _get_childNodes(self):
Expand Down Expand Up @@ -864,7 +867,7 @@ def getElementsByTagNameNS(self, namespaceURI, localName):
self, namespaceURI, localName, NodeList())

def __repr__(self):
return "<DOM Element: %s at %#x>" % (self.tagName, id(self))
return f"<DOM Element: {self.tagName}>"

def writexml(self, writer, indent="", addindent="", newl=""):
"""Write an XML element to a file-like object
Expand Down
0