diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-11-11 15:02:31 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-11-11 15:02:31 -0500 |
| commit | f298b36d4e940b1f9e737a64bbd06182da9794fa (patch) | |
| tree | 97aa9dda9aa89eb7ac6d30dd9578e05da0fcc22f /test | |
| parent | 1eb56ef02a7fa825be99ddfb95f217a07dab1cdf (diff) | |
| download | external_python_mako-f298b36d4e940b1f9e737a64bbd06182da9794fa.tar.gz external_python_mako-f298b36d4e940b1f9e737a64bbd06182da9794fa.tar.bz2 external_python_mako-f298b36d4e940b1f9e737a64bbd06182da9794fa.zip | |
all tests pass on py3k and py2.7. py2.5/2.4 next
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_exceptions.py | 8 | ||||
| -rw-r--r-- | test/test_filters.py | 8 | ||||
| -rw-r--r-- | test/test_util.py | 3 |
3 files changed, 12 insertions, 7 deletions
diff --git a/test/test_exceptions.py b/test/test_exceptions.py index d7feb9a..e860a4c 100644 --- a/test/test_exceptions.py +++ b/test/test_exceptions.py @@ -9,7 +9,7 @@ from test.util import result_lines from test import TemplateTest from test import requires_pygments_14, requires_no_pygments, \ requires_python_25_or_greater - +from mako.compat import u class ExceptionsTest(TemplateTest): def test_html_error_template(self): @@ -159,16 +159,16 @@ ${u'привет'} @requires_python_25_or_greater def test_py_utf8_html_error_template(self): try: - foo = '日本' + foo = u('日本') raise RuntimeError('test') except: html_error = exceptions.html_error_template().render() if compat.py3k: assert 'RuntimeError: test' in html_error.decode('utf-8') - assert "foo = '日本'" in html_error.decode('utf-8') + assert "foo = u('日本')" in html_error.decode('utf-8') else: assert 'RuntimeError: test' in html_error - assert "foo = u'日本'" in html_error + assert "foo = u('日本')" in html_error def test_py_unicode_error_html_error_template(self): try: diff --git a/test/test_filters.py b/test/test_filters.py index d2a6d6f..7767409 100644 --- a/test/test_filters.py +++ b/test/test_filters.py @@ -3,7 +3,8 @@ from mako.template import Template import unittest from test import TemplateTest, eq_, requires_python_2 -from .util import result_lines, flatten_result +from test.util import result_lines, flatten_result +from mako.compat import u class FilterTest(TemplateTest): def test_basic(self): @@ -87,7 +88,10 @@ class FilterTest(TemplateTest): some stuff.... ${x} """, default_filters=['decode.utf8']) #print t.code - assert t.render_unicode(x="voix m’a réveillé").strip() == "some stuff.... voix m’a réveillé" + eq_( + t.render_unicode(x=u("voix m’a réveillé")).strip(), + u("some stuff.... voix m’a réveillé") + ) def test_custom_default(self): t = Template(""" diff --git a/test/test_util.py b/test/test_util.py index a7da274..2683cd7 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -4,6 +4,7 @@ import os import unittest from mako import util, exceptions, compat from test import eq_, skip_if, assert_raises_message +from mako.compat import u class UtilTest(unittest.TestCase): def test_fast_buffer_write(self): @@ -22,7 +23,7 @@ class UtilTest(unittest.TestCase): eq_(buf.getvalue(), "string c string d") def test_fast_buffer_encoded(self): - s = "drôl m’a rée « S’il" + s = u("drôl m’a rée « S’il") buf = util.FastEncodingBuffer(encoding='utf-8') buf.write(s[0:10]) buf.write(s[10:]) |
