summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hammel <jhammel@mozilla.com>2013-12-19 19:51:41 -0800
committerJeff Hammel <jhammel@mozilla.com>2013-12-19 19:51:41 -0800
commit373a3646855561009146b4961ce69c5f27c617ab (patch)
tree763f1d371dafbfa0c17f55f460167d21a19f340e
parent5e9be25784a2a0339aa9c64e9cf8e4faf72e6ee3 (diff)
downloadtempita-373a3646855561009146b4961ce69c5f27c617ab.tar.gz
exception handling testfix
-rw-r--r--tests/test_template.txt20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/test_template.txt b/tests/test_template.txt
index 868c1e8..11a0773 100644
--- a/tests/test_template.txt
+++ b/tests/test_template.txt
@@ -66,14 +66,18 @@ Also Python blocks::
And some syntax errors::
- >>> t = Template('{{if x}}', name='foo.html') # doctest: +IGNORE_EXCEPTION_DETAIL
- Traceback (most recent call last):
- ...
- TemplateError: No {{endif}} at line 1 column 3 in foo.html
- >>> t = Template('{{for x}}', name='foo2.html')
- Traceback (most recent call last):
- ...
- TemplateError: Bad for (no "in") in 'x' at line 1 column 3 in foo2.html
+ >>> from tempita import TemplateError
+ >>> error = None
+ >>> try:
+ ... t = Template('{{if x}}', name='foo.html')
+ ... except Exception as e:
+ ... error = e
+ >>> error.__class__ == TemplateError
+ True
+ >>> error_msg = '''TemplateError: Bad for (no "in") in 'x' at line 1 column 3 in foo2.html''' # BBB python 2 error message (to deprecate)
+ >>> error_msg = 'No {{endif}} at line 1 column 3 in foo.html'
+ >>> str(error) == error_msg
+ True
There's also an HTMLTemplate that uses HTMLisms::