if compress_whitespace is None:
compress_whitespace = name.endswith(".html") or \
name.endswith(".js")
- reader = _TemplateReader(name, escape.utf8(template_string))
+ reader = _TemplateReader(name, escape.native_str(template_string))
self.file = _File(_parse(reader))
self.code = self._generate_python(loader, compress_whitespace)
try:
'tornado.test.iostream_test',
'tornado.test.simple_httpclient_test',
'tornado.test.stack_context_test',
+ 'tornado.test.template_test',
'tornado.test.testing_test',
'tornado.test.web_test',
]
--- /dev/null
+from tornado.template import Template
+from tornado.testing import LogTrapTestCase
+
+class TemplateTest(LogTrapTestCase):
+ def test_simple(self):
+ template = Template("Hello {{ name }}!")
+ self.assertEqual(template.generate(name="Ben"),
+ "Hello Ben!")