We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
python
Learn more about funding links in repositories.
Report abuse
There was an error while loading. Please reload this page.
2 parents 9f10f56 + a5f13d2 commit d9a550bCopy full SHA for d9a550b
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