diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-02-02 11:47:11 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-02-02 11:47:11 -0500 |
commit | 70dec0aee9b25e1c9ad75dae71509edd5d1de87d (patch) | |
tree | 33b33fae23dea5e1ae5e65f21332086a3d34583c | |
parent | 1efbc0327aa00b5bdda724c9e76094826ae15a3f (diff) | |
download | mako-70dec0aee9b25e1c9ad75dae71509edd5d1de87d.tar.gz |
py3k fixesrel_0_6_2
-rw-r--r-- | test/test_exceptions.py | 10 | ||||
-rw-r--r-- | test/test_template.py | 16 |
2 files changed, 20 insertions, 6 deletions
diff --git a/test/test_exceptions.py b/test/test_exceptions.py index 70fe39f..97987e6 100644 --- a/test/test_exceptions.py +++ b/test/test_exceptions.py @@ -75,10 +75,16 @@ ${u'привет'} template.render_unicode() except exceptions.CompileException, ce: html_error = exceptions.html_error_template().render() - assert ("CompileException: Fragment 'if 2 == 2: /an " + if util.py3k: + assert ("CompileException: Fragment 'if 2 == 2: /an " "error' is not a partial control statement " - "at line: 2 char: 1") in \ + "at line: 2 char: 1").encode(sys.getdefaultencoding(), 'htmlentityreplace') in \ html_error + else: + assert ("CompileException: Fragment 'if 2 == 2: /an " + "error' is not a partial control statement " + "at line: 2 char: 1") in \ + html_error if util.py3k: assert u"3 ${'привет'}".encode(sys.getdefaultencoding(), diff --git a/test/test_template.py b/test/test_template.py index 769af02..9841ac8 100644 --- a/test/test_template.py +++ b/test/test_template.py @@ -25,10 +25,18 @@ class EncodingTest(TemplateTest): except: # <h3>Exception: <span style="color:red">Foobar</span></h3> markup = html_error_template().render(full=False, css=False) - print markup - assert '<span style="color:red">Foobar</span></h3>' not in markup - assert '<span style="color:red">Foobar</span>' in markup - + if util.py3k: + assert '<span style="color:red">Foobar</span></h3>'\ + .encode('ascii') not in markup + assert '<span style="color:red"'\ + '>Foobar</span>'\ + .encode('ascii') in markup + else: + assert '<span style="color:red">Foobar</span></h3>' \ + not in markup + assert '<span style="color:red"'\ + '>Foobar</span>' in markup + def test_unicode(self): self._do_memory_test( u"""Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »""", |