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

Method test_5027_1

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

Source from the content-addressed store, hash-verified

709 self.xml('<my:a xmlns:my="qux" b="c"/>'))
710
711 def test_5027_1(self):
712 # The xml prefix (as in xml:lang below) is reserved and bound by
713 # definition to http://www.w3.org/XML/1998/namespace. XMLGenerator had
714 # a bug whereby a KeyError is raised because this namespace is missing
715 # from a dictionary.
716 #
717 # This test demonstrates the bug by parsing a document.
718 test_xml = StringIO(
719 '<?xml version="1.0"?>'
720 '<a:g1 xmlns:a="http://example.com/ns">'
721 '<a:g2 xml:lang="en">Hello</a:g2>'
722 '</a:g1>')
723
724 parser = make_parser()
725 parser.setFeature(feature_namespaces, True)
726 result = self.ioclass()
727 gen = XMLGenerator(result)
728 parser.setContentHandler(gen)
729 parser.parse(test_xml)
730
731 self.assertEqual(result.getvalue(),
732 self.xml(
733 '<a:g1 xmlns:a="http://example.com/ns">'
734 '<a:g2 xml:lang="en">Hello</a:g2>'
735 '</a:g1>'))
736
737 def test_5027_2(self):
738 # The xml prefix (as in xml:lang below) is reserved and bound by

Callers

nothing calls this directly

Calls 10

StringIOClass · 0.90
make_parserFunction · 0.90
XMLGeneratorClass · 0.90
setFeatureMethod · 0.45
ioclassMethod · 0.45
setContentHandlerMethod · 0.45
parseMethod · 0.45
assertEqualMethod · 0.45
getvalueMethod · 0.45
xmlMethod · 0.45

Tested by

no test coverage detected