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

Method test_xmlgen_encoding

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

Source from the content-addressed store, hash-verified

525 "<e a=\"&#10;&#13;&#9;\"></e></doc>"))
526
527 def test_xmlgen_encoding(self):
528 encodings = ('iso-8859-15', 'utf-8', 'utf-8-sig',
529 'utf-16', 'utf-16be', 'utf-16le',
530 'utf-32', 'utf-32be', 'utf-32le')
531 for encoding in encodings:
532 result = self.ioclass()
533 gen = XMLGenerator(result, encoding=encoding)
534
535 gen.startDocument()
536 gen.startElement("doc", {"a": '\u20ac'})
537 gen.characters("\u20ac")
538 gen.endElement("doc")
539 gen.endDocument()
540
541 self.assertEqual(result.getvalue(),
542 self.xml('<doc a="\u20ac">\u20ac</doc>', encoding=encoding))
543
544 def test_xmlgen_unencodable(self):
545 result = self.ioclass()

Callers

nothing calls this directly

Calls 10

startDocumentMethod · 0.95
startElementMethod · 0.95
charactersMethod · 0.95
endElementMethod · 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