We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 67bfe80 commit a5f13d2Copy full SHA for a5f13d2
Lib/test/test_sax.py
@@ -493,6 +493,21 @@ def func(out):
493
func(result)
494
self.assertFalse(result.closed)
495
496
+ def test_xmlgen_fragment(self):
497
+ result = self.ioclass()
498
+ gen = XMLGenerator(result)
499
+
500
+ # Don't call gen.startDocument()
501
+ gen.startElement("foo", {"a": "1.0"})
502
+ gen.characters("Hello")
503
+ gen.endElement("foo")
504
+ gen.startElement("bar", {"b": "2.0"})
505
+ gen.endElement("bar")
506
+ # Don't call gen.endDocument()
507
508
+ self.assertEqual(result.getvalue(),
509
+ self.xml('<foo a="1.0">Hello</foo><bar b="2.0"></bar>')[len(self.xml('')):])
510
511
class StringXmlgenTest(XmlgenTest, unittest.TestCase):
512
ioclass = StringIO
513
0 commit comments