comparison genshi/template/tests/directives.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
comparison
equal deleted inserted replaced
934:7c9ec79caedc 935:705727288d7e
1135 def test_multiple_vars_trailing_semicolon(self): 1135 def test_multiple_vars_trailing_semicolon(self):
1136 tmpl = MarkupTemplate("""<div xmlns:py="http://genshi.edgewall.org/"> 1136 tmpl = MarkupTemplate("""<div xmlns:py="http://genshi.edgewall.org/">
1137 <py:with vars="x = x * 2; y = x / 2;">${x} ${y}</py:with> 1137 <py:with vars="x = x * 2; y = x / 2;">${x} ${y}</py:with>
1138 </div>""") 1138 </div>""")
1139 self.assertEqual("""<div> 1139 self.assertEqual("""<div>
1140 84 42 1140 84 %s
1141 </div>""", tmpl.generate(x=42).render(encoding=None)) 1141 </div>""" % (84 / 2), tmpl.generate(x=42).render(encoding=None))
1142 1142
1143 def test_semicolon_escape(self): 1143 def test_semicolon_escape(self):
1144 tmpl = MarkupTemplate("""<div xmlns:py="http://genshi.edgewall.org/"> 1144 tmpl = MarkupTemplate("""<div xmlns:py="http://genshi.edgewall.org/">
1145 <py:with vars="x = 'here is a semicolon: ;'; y = 'here are two semicolons: ;;' ;"> 1145 <py:with vars="x = 'here is a semicolon: ;'; y = 'here are two semicolons: ;;' ;">
1146 ${x} 1146 ${x}
Copyright (C) 2012-2017 Edgewall Software