Commits

Lynn Rees committed 541dde0

- yes

  • Participants
  • Parent commits e7517ed

Comments (0)

Files changed (2)

         'Topic :: Text Processing :: Markup :: HTML',
         'Topic :: Text Processing :: Markup :: XML'
       ],
-      install_requires=[''],
+      install_requires=['lxml>=2.3', 'stuf'],
 )

File webstring/tests/test_webstring.py

 # -*- coding: utf-8 -*-
 '''Unit tests for lwebstring'''
 
+import pickle
 import unittest
-import pickle
+
+from stuf.six import u
 try:
     import lxml.etree as _etree
 except ImportError:
     '''Test class for webstring'''
 
     # Add tests
-    groupend = '<tr class="tr1"><td id="td1"/><td id="td2"/>' \
+    groupend = u(
+        '<tr class="tr1"><td id="td1"/><td id="td2"/>'
         '</tr><tr class="tr2"><td id="td1"/><td id="td2"/></tr>'
-    altgroupend = '<tr class="tr2"><td id="td1"/>' \
-        '<td id="td2"/></tr><tr class="tr1"><td id="td1"/>' \
-        '<td id="td2"/></tr>'
-    subgroupend = '<td id="td1"/><td id="td1"/>'
-    addtest = '<html><head><title id="title"/></head><html><body>' \
-        '<p id="content"/></body></html></html>'
-    altaddtest = '<html><body><p id="content"/></body><head>' \
-        '<title id="title"/></head></html>'
-    field_add = '<p id="content"/><title id="title"/>'
-    field_group_add = '<title id="title"/><tr class="tr1"><td id="td1"/>' \
-        '<td id="td2"/></tr>'
-    root_group_add = '<html><head><title id="title"/></head>' \
-        '<tr class="tr1"><td id="td1"/><td id="td2"/></tr></html>'
-    root_element_add = '<html><head><title id="title"/></head><p/>' \
-        '</html>'
-    field_element_add = '<title id="title"/><p/>'
-    group_element_add = '<tr class="tr1"><td id="td1"/>' \
-        '<td id="td2"/></tr><p/>'
-    subfield_element_add = '<td id="td1"/><p/>'
+    )
+    altgroupend = u('<tr class="tr2"><td id="td1"/>'
+        '<td id="td2"/></tr><tr class="tr1"><td id="td1"/>'
+        '<td id="td2"/></tr>')
+    subgroupend = u('<td id="td1"/><td id="td1"/>')
+    addtest = u('<html><head><title id="title"/></head><html><body>'
+        '<p id="content"/></body></html></html>')
+    altaddtest = u('<html><body><p id="content"/></body><head>'
+        '<title id="title"/></head></html>')
+    field_add = u('<p id="content"/><title id="title"/>')
+    field_group_add = u('<title id="title"/><tr class="tr1"><td id="td1"/>'
+        '<td id="td2"/></tr>')
+    root_group_add = u('<html><head><title id="title"/></head>'
+        '<tr class="tr1"><td id="td1"/><td id="td2"/></tr></html>')
+    root_element_add = u('<html><head><title id="title"/></head><p/></html>')
+    field_element_add = u('<title id="title"/><p/>')
+    group_element_add = u('<tr class="tr1"><td id="td1"/>'
+        '<td id="td2"/></tr><p/>')
+    subfield_element_add = u('<td id="td1"/><p/>')
     # Mul tests
     multest = '<p id="content"/><p id="content"/><p id="content"/>'
-    root_mul = '<html><head><title id="title"/></head><html><body>' \
-        '<p id="content"/></body></html><html><head><title id="title"/>' \
-        '</head><html><body><p id="content"/></body></html></html><html>' \
-        '<head><title id="title"/></head><html><body><p id="content"/>' \
-        '</body></html></html></html>'
-    root_group_mul = '<tr class="tr1"><td id="td1"/>' \
-        '<td id="td2"/></tr><tr class="tr1"><td id="td1"/>' \
-        '<td id="td2"/></tr><tr class="tr1"><td id="td1"/>' \
-        '<td id="td2"/></tr>'
-    subfield_group_mul = '<td id="td1"/><td id="td1"/><td id="td1"/>'
+    root_mul = u('<html><head><title id="title"/></head><html><body>'
+        '<p id="content"/></body></html><html><head><title id="title"/>'
+        '</head><html><body><p id="content"/></body></html></html><html>'
+        '<head><title id="title"/></head><html><body><p id="content"/>'
+        '</body></html></html></html>')
+    root_group_mul = u('<tr class="tr1"><td id="td1"/>'
+        '<td id="td2"/></tr><tr class="tr1"><td id="td1"/>'
+        '<td id="td2"/></tr><tr class="tr1"><td id="td1"/>'
+        '<td id="td2"/></tr>')
+    subfield_group_mul = u('<td id="td1"/><td id="td1"/><td id="td1"/>')
     # Mod tests
-    modtest1 = '<html><head><title id="title">Test Page</title>' \
-        '</head><body/></html>'
-    modtest2 = '<html><head><title id="title">Test Page</title></head>' \
-    '<html><body><p id="content">Content Goes Here</p></body></html></html>'
-    modtest3 = '<html><head><title id="title">Title</title></head>' \
-        '<body><p id="content">Test1</p><p id="content">Test2</p>' \
-        '<p id="content2">Test1</p><p id="content2">Test2</p>' \
-        '</body></html>'
-    modtest5 = '<title id="title">Test Page</title>'
-    groupmod = '<td id="td1">Test Page</td>'
-    groupmod2 = '<table><tr class="tr1"><td id="td1">Test Page</td>' \
-        '<td id="td2">Content Goes Here</td></tr></table>'
-    groupmod3 = '<table><tr class="tr1"><td id="td1">Test1</td><td ' \
-        'id="td1">Test2</td><td id="td2">Test1</td><td id="td2">Test2' \
-        '</td></tr></table>'
+    modtest1 = u('<html><head><title id="title">Test Page</title>'
+        '</head><body/></html>')
+    modtest2 = u('<html><head><title id="title">Test Page</title></head>'
+    '<html><body><p id="content">Content Goes Here</p></body></html></html>')
+    modtest3 = u('<html><head><title id="title">Title</title></head>'
+        '<body><p id="content">Test1</p><p id="content">Test2</p>'
+        '<p id="content2">Test1</p><p id="content2">Test2</p>'
+        '</body></html>')
+    modtest5 = u('<title id="title">Test Page</title>')
+    groupmod = u('<td id="td1">Test Page</td>')
+    groupmod2 = u('<table><tr class="tr1"><td id="td1">Test Page</td>'
+        '<td id="td2">Content Goes Here</td></tr></table>')
+    groupmod3 = u('<table><tr class="tr1"><td id="td1">Test1</td><td '
+        'id="td1">Test2</td><td id="td2">Test1</td><td id="td2">Test2'
+        '</td></tr></table>')
     # Pow tets
-    powtest1 = '<p id="content">Test1</p><p id="content">Test2</p>'
-    groupow = '<tr class="tr1"><td id="td1">1</td>' \
-        '<td id="td2">2</td></tr><tr class="tr1"><td id="td1">3' \
-        '</td><td id="td2">4</td></tr><tr class="tr1"><td id="td1">5' \
-        '</td><td id="td2">6</td></tr>'
+    powtest1 = u('<p id="content">Test1</p><p id="content">Test2</p>')
+    groupow = u('<tr class="tr1"><td id="td1">1</td>'
+        '<td id="td2">2</td></tr><tr class="tr1"><td id="td1">3'
+        '</td><td id="td2">4</td></tr><tr class="tr1"><td id="td1">5'
+        '</td><td id="td2">6</td></tr>')
     # Templates
-    modtemplate1 = Template('<html><head><title id="title"/></head>' \
+    modtemplate1 = Template('<html><head><title id="title"/></head>'
         '<body/></html>')
-    modtemplate3 = Template('<html><head><title id="title"></title>' \
-        '</head><body><p id="content"/><p id="content2"/></body>' \
+    modtemplate3 = Template('<html><head><title id="title"></title>'
+        '</head><body><p id="content"/><p id="content2"/></body>'
         '</html>')
     gentemplate = Template(addtest)
-    atemplate = Template('<html><head><title id="title"></title></head>' \
+    atemplate = Template('<html><head><title id="title"></title></head>'
         '</html>')
     btemplate = Template(
         '<html><body><p id="content"></p></body></html>')
-    powtemplate = Template('<html><head/><body><p id="content"/>' \
+    powtemplate = Template('<html><head/><body><p id="content"/>'
         '</body></html>')
-    agrouptest = Template('<table><tr class="tr1"><td id="td1"/>' \
+    agrouptest = Template('<table><tr class="tr1"><td id="td1"/>'
         '<td id="td2"/></tr></table>')
-    bgrouptest = Template('<table><tr class="tr2"><td id="td1"/>' \
+    bgrouptest = Template('<table><tr class="tr2"><td id="td1"/>'
         '<td id="td2"/></tr></table>')
-    subcombotest = Template('<body><a id="fieldtest" href="atest"/>' \
-        '<tr class="grouptest"><td id="groupfield1"/>' \
+    subcombotest = Template('<body><a id="fieldtest" href="atest"/>'
+        '<tr class="grouptest"><td id="groupfield1"/>'
         '<td id="groupfield2"/></tr></body>')
     rss = Template('''<rss version="2.0">
 <channel>
 
     def test_lroot_radd(self):
         '''Tests the right-side addition of two root Templates.'''
-        final = '<html><body><p id="content"/></body><html><head>' \
-            '<title id="title"/></head></html></html>'
+        final = u('<html><body><p id="content"/></body><html><head>'
+            '<title id="title"/></head></html></html>')
         atst = self.btemplate + self.atemplate
         self.assertEqual(final, atst.render())
 
 
     def test_lsubfield_radd(self):
         '''Tests the right-side addition of two subfields.'''
-        final = '<td id="td1"/><td id="td1"/>'
+        final = u('<td id="td1"/><td id="td1"/>')
         atst = self.bgrouptest.tr2.td1 + self.agrouptest.tr1.td1
         self.assertEqual(final, atst.render())
 
 
     def test_lfield_root_iadd(self):
         '''Tests the modifying addition of a field and a root Template.'''
-        final = '<title id="title"/><html><body><p id="content"/>' \
-            '</body></html>'
+        final = u('<title id="title"/><html><body><p id="content"/>'
+            '</body></html>')
         self.atemplate.title += self.btemplate
         self.assertEqual(final, self.atemplate.title.pipe())
 
 
     def test_lfield_subfield_iadd(self):
         '''Tests the modifying addition of a field and subfield.'''
-        final = '<title id="title"/><td id="td1"/>'
+        final = u('<title id="title"/><td id="td1"/>')
         self.atemplate.title += self.agrouptest.tr1.td1
         self.assertEqual(final, self.atemplate.title.pipe())
 
     def test_lroot_field_iadd(self):
         '''Tests the modifying addition of a root Template and a field.'''
-        final = '<html><body><p id="content"/></body>' \
-        '<title id="title"/></html>'
+        final = u('<html><body><p id="content"/></body>'
+        '<title id="title"/></html>')
         self.btemplate += self.atemplate.title
         self.assertEqual(final, self.btemplate.pipe())
 
 
     def test_lroot_subfield_iadd(self):
         '''Tests the modifying addition of a root Template and subfield.'''
-        final = '<html><head><title id="title"/></head><td id="td1"/></html>'
+        final = u(
+            '<html><head><title id="title"/></head><td id="td1"/></html>'
+        )
         self.atemplate += self.agrouptest.tr1.td1
         self.assertEqual(final, self.atemplate.pipe())
 
     def test_lgroup_subfield_iadd(self):
         '''Tests the modifying addition of one group and one subfield.'''
-        final = '<tr class="tr1"><td id="td1"/><td id="td2"/>' \
-            '</tr><td id="td1"/>'
+        final = u('<tr class="tr1"><td id="td1"/><td id="td2"/>'
+            '</tr><td id="td1"/>')
         self.agrouptest.tr1 += self.bgrouptest.tr2.td1
         self.assertEqual(final, self.agrouptest.tr1.pipe())
 
     def test_lsubfield_group_iadd(self):
         '''Tests the modifying addition of one subfield and one group.'''
-        final = '<td id="td1"/><tr class="tr1">' \
-            '<td id="td1"/><td id="td2"/></tr>'
+        final = u('<td id="td1"/><tr class="tr1">'
+            '<td id="td1"/><td id="td2"/></tr>')
         self.bgrouptest.tr2.td1 += self.agrouptest.tr1
         self.assertEqual(final, self.bgrouptest.tr2.td1.pipe())
 
                 'http://www.example.com/rss/5423093',
                 'Example of group repetition.',
                 {'text': {'month': 'June', 'day': '06', 'year': '2006'}}))}
-        self.assertEqual('''<rss version="2.0">
+        self.assertEqual(u('''<rss version="2.0">
 <channel>
 <title>Example</title>
 <link>http://www.example.org/</link>
 <pubDate id="ipubdate">June 06, 2006</pubDate>
 </item>
 </channel>
-</rss>''', self.rss.pipe())
+</rss>'''), self.rss.pipe())
 
     def test_lroot_imod_extended_format(self):
         '''Tests an extended format substitution on a root.'''
                          'href': {'link': 'linktest'},
                          'title': {'other': 'Link Test'}}})}}
         self.assertEqual(
-            '<body><a id="fieldtest" href="caliban.html#test" title="This '
+            u('<body><a id="fieldtest" href="caliban.html#test" title="This '
         'link goes to test">This template is a first test.</a><a '
         'id="fieldtest" href="caliban.html#linktest" title="This link goes to '
         'Link Test">This other template is a link test.</a><tr '
         'second">This second test is the second column.</td><td '
         'id="groupfield2" align="left" title="This test is next.">This test '
         'is first.</td><td id="groupfield2">This coltest is a next.</td></tr>'
-        '</body>', self.subcombotest.pipe()
+        '</body>'), self.subcombotest.pipe()
         )
 
     def test_lfield_imod_extended_format(self):
                      'href': {'link': 'linktest'},
                      'title': {'other': 'Link Test'}}})}
         self.assertEqual(
-            '<body><a id="fieldtest" href="caliban.html#test" '
+            u('<body><a id="fieldtest" href="caliban.html#test" '
             'title="This link goes to test">This template is a first '
             'test.</a><a id="fieldtest" href="caliban.html#linktest" '
             'title="This link goes to Link Test">This other template '
             'is a link test.</a><tr class="grouptest"><td '
-            'id="groupfield1"/><td id="groupfield2"/></tr></body>',
+            'id="groupfield1"/><td id="groupfield2"/></tr></body>'),
             self.subcombotest.pipe()
         )
 
                      'href': {'link': 'linktest'},
                      'title': {'other': 'Link Test'}}})}
         self.assertEqual(
-            '<body><a id="fieldtest" href="caliban.html#test" title="This '
+            u('<body><a id="fieldtest" href="caliban.html#test" title="This '
         'link goes to test">This is a test.</a><a id="fieldtest" '
         'href="caliban.html#linktest" title="This link goes to Link Test">'
         'This is another test.</a><tr class="grouptest"><td id="groupfield1"/>'
-        '<td id="groupfield2"/></tr></body>',
+        '<td id="groupfield2"/></tr></body>'),
         self.subcombotest.pipe()
     )
 
                 'text': {'test': 'first test', 'run': 'template'}}, {
                 'text': {'test': 'link test', 'run': 'other template'}})}
         self.assertEqual(
-            '<body><a id="fieldtest" href="atest">This template is '
+            u('<body><a id="fieldtest" href="atest">This template is '
             'a first test.</a><a id="fieldtest" href="atest">This other'
             ' template is a link test.</a><tr class="grouptest"><td id'
-            '="groupfield1"/><td id="groupfield2"/></tr></body>',
+            '="groupfield1"/><td id="groupfield2"/></tr></body>'),
             self.subcombotest.pipe()
         )
 
                                  'href': {'link': 'linktest'},
                                  'title': {'other': 'Link Test'}}})}}
         self.assertEqual(
-            '<body><a id="fieldtest" href="atest"/><tr class="grouptest">'
+            u('<body><a id="fieldtest" href="atest"/><tr class="grouptest">'
             '<td id="groupfield1" align="left" title="This column is column '
             'first">'
             'This first test is the first column.</td><td id="groupfield1" '
             'align="right" title="This col is column second">This second test'
             ' is the second column.</td><td id="groupfield2" align="left" '
             'title="This test is next.">This test is first.</td><td '
-            'id="groupfield2">This coltest is a next.</td></tr></body>',
+            'id="groupfield2">This coltest is a next.</td></tr></body>'),
             self.subcombotest.pipe()
         )
 
 
     def test_lattribute_get(self):
         '''Tests accessing XML attribute attributes.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>')
         self.assertEqual(atst.tr1.td1.align, 'left')
 
     def test_lattribute_set(self):
         '''Tests setting XML attribute attributes.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>')
         atst.tr1.td1.align = 'right'
         self.assertEqual(atst.tr1.td1.align, 'right')
 
     def test_lattribute_set_dict(self):
         '''Tests setting XML attribute attributes with a dict.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>')
         atst.tr1.td1.atemplates({'align': 'This is $dir'})
         atst.tr1.td1.align = {'dir': 'right'}
 
     def test_lfield_delete_attribute(self):
         '''Tests deletion of XML attribute attributes.'''
-        atst = Template('<html><body><p align="left" id="content"></p>' \
+        atst = Template('<html><body><p align="left" id="content"></p>'
             '</body></html>')
         del atst.content.align
         self.assertEqual(False, hasattr(atst.content, 'align'))
 
     def test_lsubfield_delete_attribute(self):
         '''Tests deletion of subfield XML attribute attributes.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>')
         del atst.tr1.td1.align
         self.assertEqual(False, hasattr(atst.tr1.td1, 'align'))
 
     def test_lattribute_get_key_noauto(self):
         '''Tests getting XML attributes via key w/o automagic.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>')
         self.assertEqual(atst['tr1']['td1']['align'], 'left')
 
     def test_lattribute_set_key_noauto(self):
         '''Tests setting attributes via key w/o automagic.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>', False)
         atst['tr1']['td1']['align'] = 'right'
         self.assertEqual(atst['tr1']['td1']['align'], 'right')
 
     def test_lattribute_set_key_noauto_dict(self):
         '''Tests setting attributes via key w/o automagic with a dict.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>', False)
         atst['tr1']['td1'].atemplates({'align': 'This is $dir'})
         atst['tr1']['td1']['align'] = {'dir': 'right'}
 
     def test_lfield_attribute_delete_key_noauto(self):
         '''Tests deletion of field XML attributes via key w/o automagic.'''
-        atst = Template('<html><body><p align="left" id="content"></p>' \
+        atst = Template('<html><body><p align="left" id="content"></p>'
             '</body></html>', False)
         del atst['content']['align']
         self.assertEqual(False, 'align' in atst['content'])
 
     def test_lsubfield_attribute_delete_key_noauto(self):
         '''Tests deletion of subfield XML attributes via key on automagic.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>', False)
         del atst['tr1']['td1']['align']
         self.assertEqual(False, 'align' in atst['tr1']['td1'])
 
     def test_lattribute_set_key(self):
         '''Tests setting XML attributes via key.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>')
         atst.tr1.td1['align'] = 'right'
         self.assertEqual(atst.tr1.td1['align'], 'right')
 
     def test_lattribute_set_key_dict(self):
         '''Tests setting attributes via key with a dict.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>')
         atst.tr1.td1.atemplates({'align': 'This is $dir'})
         atst.tr1.td1['align'] = {'dir': 'right'}
 
     def test_lfield_attribute_delete_key(self):
         '''Tests deletion of field XML attributes via key.'''
-        atst = Template('<html><body><p align="left" id="content"></p>' \
+        atst = Template('<html><body><p align="left" id="content"></p>'
             '</body></html>')
         del atst.content['align']
         self.assertEqual(False, hasattr(atst.content, 'align'))
 
     def test_lsubfield_attribute_delete_key(self):
         '''Tests deletion of subfield XML attributes via key.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
         'align="left"/><td id="td2"/></tr></table>')
         del atst.tr1.td1['align']
         self.assertEqual(False, hasattr(atst.tr1.td1, 'align'))
 
     def test_lattribute_len(self):
         '''Tests discovering the number of XML attributes in a field.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
             'align="left"/><td id="td2"/></tr></table>')
         self.assertEqual(len(atst.tr1.td1), 2)
 
     def test_lattribute_iter(self):
         '''Tests accessing XML attributes via iterator.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
             'align="left"/><td id="td2"/></tr></table>')
         test = [i for i in atst.tr1.td1]
         self.assertEqual(['id', 'align'], test)
 
     def test_lattribute_contains(self):
         '''Tests if an attribute is in a field or not.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
             'align="left"/><td id="td2"/></tr></table>')
         self.assertEqual(True, 'align' in atst.tr1.td1)
 
     def test_lattribute_contains_not(self):
         '''Tests if an attribute is in a field or not.'''
-        atst = Template('<table><tr class="tr1"><td id="td1" ' \
+        atst = Template('<table><tr class="tr1"><td id="td1" '
             'align="left"/><td id="td2"/></tr></table>')
         self.assertEqual(False, 'align' in atst.tr1)
 
         test = Template('<head><link id="test"/></head>')
         test.test.update({'href': 'thing.css', 'type': 'text/css'})
         self.assertEqual(
-            '<head><link id="test" href="thing.css" type="text/css"/></head>',
+            u('<head><link id="test" href="thing.css" type="text/css"/>'
+            '</head>'),
             test.render()
         )
 
 
     def test_lfield_purge(self):
         '''Tests if an XML attribute is purged from a field or not.'''
-        final = '<body><a/><tr class="grouptest"><td id="groupfield1"/>' \
-             '<td id="groupfield2"/></tr></body>'
+        final = u('<body><a/><tr class="grouptest"><td id="groupfield1"/>'
+             '<td id="groupfield2"/></tr></body>')
         self.subcombotest.fieldtest.purge('href', 'id')
         self.assertEqual(final, self.subcombotest.pipe())
 
     def test_lsubfield_purge(self):
         '''Tests if an XML attribute is purged from a field or not.'''
-        final = '<body><a id="fieldtest" href="atest"/>' \
-             '<tr class="grouptest"><td/><td id="groupfield2"/></tr></body>'
+        final = u('<body><a id="fieldtest" href="atest"/>'
+             '<tr class="grouptest"><td/><td id="groupfield2"/></tr></body>')
         self.subcombotest.grouptest.groupfield1.purge('id')
         self.assertEqual(final, self.subcombotest.pipe())
 
     def test_lroot_nomarks(self):
         '''Tests deletion of marks and groupmarks of a root's children.'''
-        final = '<body><a href="atest"/><tr><td/><td/></tr></body>'
+        final = u('<body><a href="atest"/><tr><td/><td/></tr></body>')
         del self.subcombotest.mark
         del self.subcombotest.groupmark
         self.assertEqual(final, self.subcombotest.pipe())
 
     def test_lgroup_nomarks(self):
         '''Tests deletion of marks and groupmarks of a field's children.'''
-        final = '<body><a id="fieldtest" href="atest"/><tr><td/><td/>' \
-            '</tr></body>'
+        final = u('<body><a id="fieldtest" href="atest"/><tr><td/><td/>'
+            '</tr></body>')
         del self.subcombotest.grouptest.mark
         del self.subcombotest.grouptest.groupmark
         self.assertEqual(final, self.subcombotest.pipe())
 
     def test_lfield_nomarks(self):
         '''Tests deletion of marks of a field.'''
-        final = '<body><a href="atest"/><tr class="grouptest">' \
-        '<td id="groupfield1"/><td id="groupfield2"/></tr></body>'
+        final = u('<body><a href="atest"/><tr class="grouptest">'
+        '<td id="groupfield1"/><td id="groupfield2"/></tr></body>')
         del self.subcombotest.fieldtest.mark
         self.assertEqual(final, self.subcombotest.pipe())
 
 
     def test_latemplate_source_interpolation(self):
         '''Tests getting attribute template from inline text in the source.'''
-        final = '<body><p id="content" title="This run is a test."/></body>'
-        atst = Template('<body><p id="content" title="This %(t1)s is a ' \
+        final = u('<body><p id="content" title="This run is a test."/></body>')
+        atst = Template('<body><p id="content" title="This %(t1)s is a '
             '%(t2)s"/></body>')
         atst.content.update({'title': {'t1': 'run', 't2': 'test.'}})
         self.assertEqual(final, atst.render())
 
     def test_latemplate_source_string_template(self):
         '''Tests getting attribute template from inline text in the source.'''
-        final = '<body><p id="content" title="This run is a test."/></body>'
-        atst = Template('<body><p id="content" title="This $t1 is a ' \
+        final = u('<body><p id="content" title="This run is a test."/></body>')
+        atst = Template('<body><p id="content" title="This $t1 is a '
             '$t2"/></body>')
         atst.content.update({'title': {'t1': 'run', 't2': 'test.'}})
         self.assertEqual(final, atst.render())
 
     def test_lauto_auto_off_attribute(self):
         '''Tests if auto turns off magical attributes for attributes.'''
-        atst = Template('<html><head><title id="title" style="style"/>' \
+        atst = Template('<html><head><title id="title" style="style"/>'
             '</head><body><p id="content"/></body></html>', False)
         self.assertEqual(hasattr(atst[0], 'style'), False)
 
                          'href': {'link': 'linktest'},
                          'title': {'other': 'Link Test'}}})}}
         self.assertEqual(
-        '<body><a id="fieldtest" href="caliban.html#test" '
+        u('<body><a id="fieldtest" href="caliban.html#test" '
         'title="This link goes to test">This template is a first test.</a><a '
         'id="fieldtest" href="caliban.html#linktest" title="This link goes to '
         'Link Test">This other template is a link test.</a><tr '
         'second">This second test is the second column.</td><td '
         'id="groupfield2" align="left" title="This test is next.">This test '
         'is first.</td><td id="groupfield2">This coltest is a next.</td></tr>'
-        '</body>', self.subcombotest.pipe()
+        '</body>'), self.subcombotest.pipe()
         )
 
     def test_ltemplates_mixin(self):
                         'text': 'This test is first.'}, {
                         'text': {'test': 'coltest', 'fill': 'next'}})}}
         self.assertEqual(
-            '<body><a id="fieldtest" href="atest"/><tr class="grouptest">'
+            u('<body><a id="fieldtest" href="atest"/><tr class="grouptest">'
         '<td id="groupfield1" align="left" title="This column is column '
         'first">one</td><td id="groupfield1" align="right" title="This col '
         'is column second">This second test is the second column.</td><td '
         'id="groupfield2">This test is first.</td><td id="groupfield2">This '
-        'coltest is a next.</td></tr></body>',
+        'coltest is a next.</td></tr></body>'),
         self.subcombotest.pipe()
         )
 
         )
         ast.stuff.text = {'tst1': 'run', 'tst2': 'test.'}
         self.assertEqual(
-            '<body><p id="stuff">This run is a test.</p></body>', ast.render()
+            u('<body><p id="stuff">This run is a test.</p></body>'),
+            ast.render()
         )
 
     def test_ltemplate_nodelimiter(self):
         atst.content.template = 'This is a %(place)s'
         atst.content.text = {'place': 'test'}
         self.assertEqual(
-            atst.content.render(), '<p id="content">This is a test</p>'
+            atst.content.render(), u('<p id="content">This is a test</p>')
         )
 
     def test_ltemplate_text_string_template(self):
         atst.content.template = 'This is a $place'
         atst.content.text = {'place': 'test'}
         self.assertEqual(
-            atst.content.render(), '<p id="content">This is a test</p>'
+            atst.content.render(), u('<p id="content">This is a test</p>')
         )
 
     def test_lroot_max(self):
         '''Tests appending a field to a root Template.'''
         self.atemplate.append(self.atemplate.title.default)
         self.assertEqual(
-            '<html><head><title id="title"/></head><title id="title"/></html>',
+            u('<html><head><title id="title"/></head><title id="title"/>'
+            '</html>'),
             self.atemplate.pipe()
         )
 
         '''Tests appending an element to a root Template.'''
         self.atemplate.append(_Element('p'))
         self.assertEqual(
-            '<html><head><title id="title"/></head><p/></html>',
+            u('<html><head><title id="title"/></head><p/></html>'),
             self.atemplate.pipe()
         )
 
         '''Tests appending a root Template to a field.'''
         self.atemplate.title.append(self.atemplate.default)
         self.assertEqual(
-            '<html><head><title id="title"><html><head>'
-            '<title id="title"/></head></html></title></head></html>',
+            u('<html><head><title id="title"><html><head>'
+            '<title id="title"/></head></html></title></head></html>'),
             self.atemplate.pipe()
         )
 
         '''Tests appending an element to a field.'''
         self.atemplate.title.append(_Element('p'))
         self.assertEqual(
-            '<html><head><title id="title"><p/></title></head></html>',
+            u('<html><head><title id="title"><p/></title></head></html>'),
             self.atemplate.pipe()
         )
 
         '''Tests appending a root Template to a group.'''
         self.agrouptest.tr1.append(self.agrouptest.default)
         self.assertEqual(
-            '<table><tr class="tr1"><td id="td1"/><td id="td2"/>'
+            u('<table><tr class="tr1"><td id="td1"/><td id="td2"/>'
             '<table><tr class="tr1"><td id="td1"/><td id="td2"/></tr>'
-            '</table></tr></table>',
+            '</table></tr></table>'),
             self.agrouptest.pipe()
         )
 
         test = self.agrouptest.render()
         self.agrouptest.tr1.reset()
         self.assertEqual(
-            '<table><tr class="tr1"><td id="td1"/><td id="td2"/>'
+            u('<table><tr class="tr1"><td id="td1"/><td id="td2"/>'
             '<table><tr class="tr1"><td id="td1"/><td id="td2"/></tr>'
-            '</table></tr></table>',
+            '</table></tr></table>'),
             test
         )
 
         '''Tests appending an element to a group.'''
         self.agrouptest.tr1.append(_Element('p'))
         self.assertEqual(
-            '<table><tr class="tr1"><td id="td1"/><td id="td2"/>'
-            '<p/></tr></table>',
+            u('<table><tr class="tr1"><td id="td1"/><td id="td2"/>'
+            '<p/></tr></table>'),
             self.agrouptest.pipe()
         )
 
         '''Tests for correct HTML 4.0 output.'''
         self.htmlt %= ('Test Page', 'Test Content')
         self.assertEqual(
-            '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 '
+            u('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 '
             'Transitional//EN">\n<html><head><link href="test.css" '
             'type="text/css"><title id="title">Test Page</title>'
-            '</head><body><p id="content">Test Content</p></body></html>',
+            '</head><body><p id="content">Test Content</p></body></html>'),
             self.htmlt.pipe()
         )
 
         '''Tests for correct XHTML 1.0 output.'''
         self.htmlt %= ('Test Page', 'Test Content')
         self.assertEqual(
-            '<?xml version="1.0" encoding="utf-8"?>\n<?xml-stylesheet '
-        'href="test.css" type="text/css" ?>\n<!DOCTYPE html PUBLIC '
-        '"-//W3C//DTD XHTML 1.0 Strict//EN" '
-        '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html>'
-        '<head><link href="test.css" type="text/css"/><title id="title">'
-        'Test Page</title></head><body><p id="content">Test Content</p>'
-        '</body></html>',
-        self.htmlt.pipe(None, 'xhtml10'))
+            u('<?xml version="1.0" encoding="utf-8"?>\n<?xml-stylesheet '
+            'href="test.css" type="text/css" ?>\n<!DOCTYPE html PUBLIC '
+            '"-//W3C//DTD XHTML 1.0 Strict//EN" '
+            '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html>'
+            '<head><link href="test.css" type="text/css"/><title id="title">'
+            'Test Page</title></head><body><p id="content">Test Content</p>'
+            '</body></html>'),
+            self.htmlt.pipe(None, 'xhtml10'),
+        )
 
     def test_lhtmltemplate_output_xhtml11(self):
         '''Tests for correct XHTML 1.1 output.'''
         self.htmlt %= ('Test Page', 'Test Content')
         self.assertEqual(
-            '<?xml version="1.0" encoding="utf-8"?>\n<?xml-stylesheet '
-        'href="test.css" type="text/css" ?>\n<!DOCTYPE html PUBLIC '
-        '"-//W3C//DTD XHTML 1.1//EN" '
-        '"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html><head><link '
-        'href="test.css" type="text/css"/><title id="title">Test Page</title>'
-        '</head><body><p id="content">Test Content</p></body></html>',
-        self.htmlt.pipe(None, 'xhtml11'))
+            u('<?xml version="1.0" encoding="utf-8"?>\n<?xml-stylesheet '
+            'href="test.css" type="text/css" ?>\n<!DOCTYPE html PUBLIC '
+            '"-//W3C//DTD XHTML 1.1//EN" '
+            '"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html><head>'
+            '<link href="test.css" type="text/css"/><title id="title">'
+            'Test Page</title></head><body><p id="content">Test Content</p>'
+            '</body></html>'
+            ),
+            self.htmlt.pipe(None, 'xhtml11')
+        )
 
     def test_pickle(self):
         serial = pickle.dumps(self.subcombotest)
         deserial = pickle.loads(serial)
         self.assertEqual(
             deserial.render(),
-            '<body><a href="atest" id="fieldtest"/><tr class="grouptest">'
-            '<td id="groupfield1"/><td id="groupfield2"/></tr></body>'
+            u('<body><a href="atest" id="fieldtest"/><tr class="grouptest">'
+            '<td id="groupfield1"/><td id="groupfield2"/></tr></body>')
         )
 
     def html_pickle(self):
         deserial = pickle.loads(serial)
         self.assertEqual(
             deserial.render(),
-            '<html><head><link href="test.css" '
+            u('<html><head><link href="test.css" '
             'type="text/css"><title id="title"><body><p id="content">'
-            '</body></head></html>'
+            '</body></head></html>')
         )