|
@@ -537,7 +537,8 @@ def compare_xml(want, got):
|
|
|
"""
|
|
|
Try to do a 'xml-comparison' of want and got. Plain string comparison
|
|
|
doesn't always work because, for example, attribute ordering should not be
|
|
|
- important. Ignore comment nodes and leading and trailing whitespace.
|
|
|
+ important. Ignore comment nodes, document type node, and leading and
|
|
|
+ trailing whitespaces.
|
|
|
|
|
|
Based on https://github.com/lxml/lxml/blob/master/src/lxml/doctestcompare.py
|
|
|
"""
|
|
@@ -575,7 +576,7 @@ def compare_xml(want, got):
|
|
|
|
|
|
def first_node(document):
|
|
|
for node in document.childNodes:
|
|
|
- if node.nodeType != Node.COMMENT_NODE:
|
|
|
+ if node.nodeType not in (Node.COMMENT_NODE, Node.DOCUMENT_TYPE_NODE):
|
|
|
return node
|
|
|
|
|
|
want = want.strip().replace('\\n', '\n')
|