(self)
| 735 | '</a:g1>')) |
| 736 | |
| 737 | def test_5027_2(self): |
| 738 | # The xml prefix (as in xml:lang below) is reserved and bound by |
| 739 | # definition to http://www.w3.org/XML/1998/namespace. XMLGenerator had |
| 740 | # a bug whereby a KeyError is raised because this namespace is missing |
| 741 | # from a dictionary. |
| 742 | # |
| 743 | # This test demonstrates the bug by direct manipulation of the |
| 744 | # XMLGenerator. |
| 745 | result = self.ioclass() |
| 746 | gen = XMLGenerator(result) |
| 747 | |
| 748 | gen.startDocument() |
| 749 | gen.startPrefixMapping('a', 'http://example.com/ns') |
| 750 | gen.startElementNS(('http://example.com/ns', 'g1'), 'g1', {}) |
| 751 | lang_attr = {('http://www.w3.org/XML/1998/namespace', 'lang'): 'en'} |
| 752 | gen.startElementNS(('http://example.com/ns', 'g2'), 'g2', lang_attr) |
| 753 | gen.characters('Hello') |
| 754 | gen.endElementNS(('http://example.com/ns', 'g2'), 'g2') |
| 755 | gen.endElementNS(('http://example.com/ns', 'g1'), 'g1') |
| 756 | gen.endPrefixMapping('a') |
| 757 | gen.endDocument() |
| 758 | |
| 759 | self.assertEqual(result.getvalue(), |
| 760 | self.xml( |
| 761 | '<a:g1 xmlns:a="http://example.com/ns">' |
| 762 | '<a:g2 xml:lang="en">Hello</a:g2>' |
| 763 | '</a:g1>')) |
| 764 | |
| 765 | def test_no_close_file(self): |
| 766 | result = self.ioclass() |
nothing calls this directly
no test coverage detected