diff genshi/template/tests/loader.py @ 935:705727288d7e

Merge r1143 from 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 Fri, 18 Mar 2011 09:17:52 +0000
parents 85e4678337cf
children
line wrap: on
line diff
--- a/genshi/template/tests/loader.py
+++ b/genshi/template/tests/loader.py
@@ -347,7 +347,7 @@
         assert 'tmpl2.html' not in loader._cache
 
     def test_load_with_default_encoding(self):
-        f = open(os.path.join(self.dirname, 'tmpl.html'), 'w')
+        f = open(os.path.join(self.dirname, 'tmpl.html'), 'wb')
         try:
             f.write(u'<div>\xf6</div>'.encode('iso-8859-1'))
         finally:
@@ -356,7 +356,7 @@
         loader.load('tmpl.html')
 
     def test_load_with_explicit_encoding(self):
-        f = open(os.path.join(self.dirname, 'tmpl.html'), 'w')
+        f = open(os.path.join(self.dirname, 'tmpl.html'), 'wb')
         try:
             f.write(u'<div>\xf6</div>'.encode('iso-8859-1'))
         finally:
Copyright (C) 2012-2017 Edgewall Software