Exemple #1
0
 def test_media_element(self):
     outfile = StringIO()
     handler = CustomXMLGenerator(outfile, ENCODING)
     root = MediaElement('root')
     elem = MediaElement('a', 'd', {'b': 'c'})
     root.append(elem)
     root.add_to(handler)
     tools.assert_equals('<root><a b="c">d</a></root>', outfile.getvalue())
     outfile.close()
 def test_cdata_contents(self):
     outfile = StringIO()
     handler = CustomXMLGenerator(outfile, ENCODING)
     handler.addQuickElement(u'a', '<>')
     self.assert_equals('<a><![CDATA[<>]]></a>', outfile.getvalue())
     outfile.close()
 def test_empty_tag_with_attributes(self):
     outfile = StringIO()
     handler = CustomXMLGenerator(outfile, ENCODING)
     handler.addEmptyElement(u'a', {'b': 'c'})
     self.assert_equals('<a b="c"/>', outfile.getvalue())
     outfile.close()
 def test_empty_tag(self):
     outfile = StringIO()
     handler = CustomXMLGenerator(outfile, ENCODING)
     handler.addEmptyElement(u'a')
     self.assert_equals('<a/>', outfile.getvalue())
     outfile.close()
Exemple #5
0
 def test_cdata_contents(self):
     outfile = StringIO()
     handler = CustomXMLGenerator(outfile, ENCODING)
     handler.addQuickElement(u'a', '<>')
     tools.assert_equals('<a><![CDATA[<>]]></a>', outfile.getvalue())
     outfile.close()
Exemple #6
0
 def test_empty_tag_with_attributes(self):
     outfile = StringIO()
     handler = CustomXMLGenerator(outfile, ENCODING)
     handler.addEmptyElement(u'a', {'b': 'c'})
     tools.assert_equals('<a b="c"/>', outfile.getvalue())
     outfile.close()
Exemple #7
0
 def test_empty_tag(self):
     outfile = StringIO()
     handler = CustomXMLGenerator(outfile, ENCODING)
     handler.addEmptyElement(u'a')
     tools.assert_equals('<a/>', outfile.getvalue())
     outfile.close()
Exemple #8
0
 def test_cdata_contents(self):
     outfile = StringIO()
     handler = CustomXMLGenerator(outfile, ENCODING)
     handler.addQuickElement(u"a", "<>")
     tools.assert_equals("<a><![CDATA[<>]]></a>", outfile.getvalue())
     outfile.close()