summaryrefslogtreecommitdiff
path: root/pystache
diff options
context:
space:
mode:
Diffstat (limited to 'pystache')
-rw-r--r--pystache/tests/test_renderengine.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/pystache/tests/test_renderengine.py b/pystache/tests/test_renderengine.py
index e411ce9..3629708 100644
--- a/pystache/tests/test_renderengine.py
+++ b/pystache/tests/test_renderengine.py
@@ -5,6 +5,7 @@ Unit tests of renderengine.py.
"""
+import sys
import unittest
from pystache.context import ContextStack, KeyNotFoundError
@@ -14,6 +15,14 @@ from pystache.renderengine import context_get, RenderEngine
from pystache.tests.common import AssertStringMixin, AssertExceptionMixin, Attachable
+def _get_unicode_char():
+ if sys.version_info < (3, ):
+ return 'u'
+ return ''
+
+_UNICODE_CHAR = _get_unicode_char()
+
+
def mock_literal(s):
"""
For use as the literal keyword argument to the RenderEngine constructor.
@@ -646,5 +655,6 @@ class RenderTests(unittest.TestCase, AssertStringMixin, AssertExceptionMixin):
self._assert_render(u'A', template, context)
template = '{{#c}}{{a.b}}{{/c}}'
- self.assertException(KeyNotFoundError, "Key u'a.b' not found: missing u'b'",
- self._assert_render, u'A.B :: (A :: )', template, context)
+ self.assertException(KeyNotFoundError, "Key %(unicode)s'a.b' not found: missing %(unicode)s'b'" %
+ {'unicode': _UNICODE_CHAR},
+ self._assert_render, 'A.B :: (A :: )', template, context)