diff genshi/template/tests/plugin.py @ 918:006b0fa6991c experimental-py3k

add support for python 3 to remaining genshi.template components: * minor changes to track encoding=None API change in core genshi modules. * genshi/template/directives: * slightly odd syntax changes to make the 2to3 .next() fixer pick up *stream.next() * minor test fix for change in behaviour of division (/) in Python 3. * genshi/template/loader: * add 'b' to file modes to ensure it's loaded as bytes in Python 3. * use not isinstance(s, unicode) instead of isinstance(s, str) since the former is correctly converted by 2to3.
author hodgestar
date Sun, 24 Oct 2010 22:48:15 +0000
parents 09a90feb9269
children
line wrap: on
line diff
--- a/genshi/template/tests/plugin.py
+++ b/genshi/template/tests/plugin.py
@@ -30,7 +30,7 @@
 
     def test_init_no_options(self):
         plugin = MarkupTemplateEnginePlugin()
-        self.assertEqual('utf-8', plugin.default_encoding)
+        self.assertEqual(None, plugin.default_encoding)
         self.assertEqual('html', plugin.default_format)
         self.assertEqual(None, plugin.default_doctype)
 
@@ -165,7 +165,7 @@
     def test_helper_functions(self):
         plugin = MarkupTemplateEnginePlugin()
         tmpl = plugin.load_template(PACKAGE + '.templates.functions')
-        output = plugin.render({'snippet': '<b>Foo</b>'}, template=tmpl)
+        output = plugin.render({'snippet': u'<b>Foo</b>'}, template=tmpl)
         self.assertEqual("""<div>
 False
 bar
@@ -178,7 +178,7 @@
 
     def test_init_no_options(self):
         plugin = TextTemplateEnginePlugin()
-        self.assertEqual('utf-8', plugin.default_encoding)
+        self.assertEqual(None, plugin.default_encoding)
         self.assertEqual('text', plugin.default_format)
 
         self.assertEqual([], plugin.loader.search_path)
Copyright (C) 2012-2017 Edgewall Software