aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_exceptions.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-06-22 11:57:18 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-06-22 11:57:18 -0400
commit808dde1450ace1a929d2f6a289bd3e6293c84bad (patch)
treee4befca0e7c86bbaa925a2c89e2ed097c1e9e374 /test/test_exceptions.py
parent6fbcfe7a4df62f0b217539b9c931d1068e947b70 (diff)
downloadexternal_python_mako-808dde1450ace1a929d2f6a289bd3e6293c84bad.tar.gz
external_python_mako-808dde1450ace1a929d2f6a289bd3e6293c84bad.tar.bz2
external_python_mako-808dde1450ace1a929d2f6a289bd3e6293c84bad.zip
- Fixed call to "unicode.strip" in
exceptions.text_error_template which is not Py3k compatible. [ticket:137]
Diffstat (limited to 'test/test_exceptions.py')
-rw-r--r--test/test_exceptions.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/test/test_exceptions.py b/test/test_exceptions.py
index 13be3a8..c136725 100644
--- a/test/test_exceptions.py
+++ b/test/test_exceptions.py
@@ -17,12 +17,12 @@ class ExceptionsTest(TemplateTest):
try:
template = Template(code)
template.render_unicode()
+ assert False
except exceptions.CompileException, ce:
html_error = exceptions.html_error_template().render_unicode()
assert ("CompileException: Fragment 'i = 0' is not a partial "
"control statement") in html_error
assert '<style>' in html_error
- assert '</style>' in html_error
html_error_stripped = html_error.strip()
assert html_error_stripped.startswith('<html>')
assert html_error_stripped.endswith('</html>')
@@ -30,18 +30,30 @@ class ExceptionsTest(TemplateTest):
not_full = exceptions.html_error_template().\
render_unicode(full=False)
assert '<html>' not in not_full
- assert '</html>' not in not_full
assert '<style>' in not_full
- assert '</style>' in not_full
no_css = exceptions.html_error_template().\
render_unicode(css=False)
assert '<style>' not in no_css
- assert '</style>' not in no_css
else:
assert False, ("This function should trigger a CompileException, "
"but didn't")
+ def test_text_error_template(self):
+ code = """
+% i = 0
+"""
+ try:
+ template = Template(code)
+ template.render_unicode()
+ assert False
+ except exceptions.CompileException, ce:
+ text_error = exceptions.text_error_template().render_unicode()
+ assert 'Traceback (most recent call last):' in text_error
+ assert ("CompileException: Fragment 'i = 0' is not a partial "
+ "control statement") in text_error
+
+
def test_utf8_html_error_template(self):
"""test the html_error_template with a Template containing utf8
chars"""