Esempio n. 1
0
    def testUnicode(self):
        x = Element("x")
        x.comment(u"\u03a3")
        x.flatten()
        self.assertEquals(unicode(x), u"<x><!-- \u03a3 --></x>")

        x = Element(u"\u03a3")
        self.assertEquals(unicode(x), u"<\u03a3/>")

        x = Element("x", [(u"\u03a3", "foo")])
        self.assertEquals(unicode(x), u'<x \u03a3="foo"/>')

        x = Element("x", [("foo", u"\u03a3")])
        self.assertEquals(unicode(x), u'<x foo="\u03a3"/>')

        x = Element("x")
        x.text(u"\u03a3")
        x.flatten()
        self.assertEquals(unicode(x), u"<x>\u03a3</x>")
Esempio n. 2
0
 def testUnicode(self):
     x = Element("x")
     x.comment(u'\u03a3')
     x.flatten()
     self.assertEquals(unicode(x), u'<x><!-- \u03a3 --></x>')
     
     x = Element(u'\u03a3')
     self.assertEquals(unicode(x), u'<\u03a3/>')
     
     x = Element('x', [(u'\u03a3', 'foo')])
     self.assertEquals(unicode(x), u'<x \u03a3="foo"/>')
     
     x = Element('x', [('foo', u'\u03a3')])
     self.assertEquals(unicode(x), u'<x foo="\u03a3"/>')
     
     x = Element('x')
     x.text(u'\u03a3')
     x.flatten()
     self.assertEquals(unicode(x), u'<x>\u03a3</x>')
Esempio n. 3
0
 def testFlatten(self):
     x = Element("x")
     x.text("y")
     x.flatten()
     self.assertEquals(str(x), "<x>y</x>")
Esempio n. 4
0
 def testText(self):
     x = Element("x")
     x.text("y")
     self.assertEquals(str(x), "<x>\n\ty\n</x>")