MCPcopy Index your code
hub / github.com/python/cpython / test_xmlgen_ns

Method test_xmlgen_ns

Lib/test/test_sax.py:599–615  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

597 self.xml('<doc a="\u20ac">\u20ac </doc>', encoding=encoding))
598
599 def test_xmlgen_ns(self):
600 result = self.ioclass()
601 gen = XMLGenerator(result)
602
603 gen.startDocument()
604 gen.startPrefixMapping("ns1", ns_uri)
605 gen.startElementNS((ns_uri, "doc"), "ns1:doc", {})
606 # add an unqualified name
607 gen.startElementNS((None, "udoc"), None, {})
608 gen.endElementNS((None, "udoc"), None)
609 gen.endElementNS((ns_uri, "doc"), "ns1:doc")
610 gen.endPrefixMapping("ns1")
611 gen.endDocument()
612
613 self.assertEqual(result.getvalue(), self.xml(
614 '<ns1:doc xmlns:ns1="%s"><udoc></udoc></ns1:doc>' %
615 ns_uri))
616
617 def test_xmlgen_ns_empty(self):
618 result = self.ioclass()

Callers

nothing calls this directly

Calls 11

startDocumentMethod · 0.95
startPrefixMappingMethod · 0.95
startElementNSMethod · 0.95
endElementNSMethod · 0.95
endPrefixMappingMethod · 0.95
endDocumentMethod · 0.95
XMLGeneratorClass · 0.90
ioclassMethod · 0.45
assertEqualMethod · 0.45
getvalueMethod · 0.45
xmlMethod · 0.45

Tested by

no test coverage detected