MCPcopy
hub / github.com/scrapy/scrapy / assertXmlEquivalent

Method assertXmlEquivalent

tests/test_exporters.py:394–405  ·  view source on GitHub ↗
(self, first, second, msg=None)

Source from the content-addressed store, hash-verified

392 return XmlItemExporter(self.output, **kwargs)
393
394 def assertXmlEquivalent(self, first, second, msg=None):
395 def xmltuple(elem):
396 children = list(elem.iterchildren())
397 if children:
398 return [(child.tag, sorted(xmltuple(child))) for child in children]
399 return [(elem.tag, [(elem.text, ())])]
400
401 def xmlsplit(xmlcontent):
402 doc = lxml.etree.fromstring(xmlcontent)
403 return xmltuple(doc)
404
405 assert xmlsplit(first) == xmlsplit(second), msg
406
407 def assertExportResult(self, item, expected_value):
408 fp = BytesIO()

Callers 2

assertExportResultMethod · 0.95
_check_outputMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected