Exemplo n.º 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()
Exemplo n.º 2
0
 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()
Exemplo n.º 3
0
 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()
Exemplo n.º 4
0
 def test_empty_tag(self):
     outfile = StringIO()
     handler = CustomXMLGenerator(outfile, ENCODING)
     handler.addEmptyElement(u'a')
     self.assert_equals('<a/>', outfile.getvalue())
     outfile.close()
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 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()