Thanks to visit codestin.com Credit goes to github.com
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.
2 parents fca677a + d9a550b commit bd9b561Copy full SHA for bd9b561
1 file changed
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