Home | Trees | Indices | Help |
|
---|
|
1 # -*- coding: utf-8 -*- 2 import unittest, doctest 3 4 from common_imports import StringIO, etree, SillyFileLike 5 6 ascii_uni = u'a' 7 8 uni = u'á\uF8D2' # klingon etc. 9 10 uxml = u"<test><title>test á\uF8D2</title><h1>page á\uF8D2 title</h1></test>" 111648 49 ## def test_parse_fileobject_unicode(self): 50 ## # parse unicode from unamed file object (not support by ElementTree) 51 ## f = SillyFileLike(uxml) 52 ## root = etree.parse(f).getroot() 53 ## self.assertEquals(unicode(etree.tostring(root, 'UTF-8'), 'UTF-8'), 54 ## uxml) 5518 uxml = u'<?xml version="1.0" encoding="UTF-8"?>' + \ 19 u'<p>%s</p>' % uni 20 self.assertRaises(ValueError, etree.XML, uxml)21 25 3032 qname = etree.QName(uni, uni) 33 tag = u"{%s}%s" % (uni, uni) 34 self.assertEquals(qname.text, tag) 35 self.assertEquals(unicode(qname), tag)36 40 4457 suite = unittest.TestSuite() 58 suite.addTests([unittest.makeSuite(UnicodeTestCase)]) 59 return suite60
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0 on Mon Feb 11 15:49:41 2008 | http://epydoc.sourceforge.net |