Skip to content
Myr

test_debug.py

This file

Path

tests/test_debug.py

49 lines · 1.2 KiB · Python

Last changed by

Improved Jinja's debugging support by introducing "@internalcode" which marks code objects that are skipped on tracebacks. Also template errors are now translated as well to help the pylons debugger.Armin Ronacherbefore adoptiond416a97

History of this file

Take it

even more tests, fixed severe bug with autoescaping.Armin Ronacherbefore adoption5411ce7

lines 1–7why, one step back
1# -*- coding: utf-8 -*-
2"""3 Test debug interface4 ~~~~~~~~~~~~~~~~~~~~56 Tests the traceback rewriter.7

Copyright switch to "The Jinja Team".Armin Ronacherbefore adoption62ccd1b

line 8why, one step back
8 :copyright: (c) 2009 by the Jinja Team.

even more tests, fixed severe bug with autoescaping.Armin Ronacherbefore adoption5411ce7

lines 9–33why, one step back
9 :license: BSD.
10"""11from jinja2 import Environment12from test_loaders import filesystem_loader131415env = Environment(loader=filesystem_loader)161718test_runtime_error = '''19>>> tmpl = MODULE.env.get_template('broken.html')20>>> tmpl.render(fail=lambda: 1 / 0)21Traceback (most recent call last):22 File "loaderres/templates/broken.html", line 2, in top-level template code23 {{ fail() }}24 File "<doctest test_runtime_error[1]>", line 1, in <lambda>25 tmpl.render(fail=lambda: 1 / 0)26ZeroDivisionError: integer division or modulo by zero27'''282930test_syntax_error = '''31>>> tmpl = MODULE.env.get_template('syntaxerror.html')32Traceback (most recent call last):33 ...

Various cleanups and added custom cycler.Armin Ronacherbefore adoptionccae055

line 34why, one step back
34 File "loaderres/templates/syntaxerror.html", line 4

even more tests, fixed severe bug with autoescaping.Armin Ronacherbefore adoption5411ce7

line 35why, one step back
35 {% endif %}

Improved Jinja's debugging support by introducing "@internalcode" which marks code objects that are skipped on tracebacks. Also template errors are now translated as well to help the pylons debugger.Armin Ronacherbefore adoptiond416a97

lines 36–48why, one step back
36TemplateSyntaxError: unknown tag 'endif'
37'''383940test_regular_syntax_error = '''41>>> from jinja2.exceptions import TemplateSyntaxError42>>> raise TemplateSyntaxError('wtf', 42)43Traceback (most recent call last):44 ...45 File "<doctest test_regular_syntax_error[1]>", line 1, in <module>46 raise TemplateSyntaxError('wtf', 42)47TemplateSyntaxError: wtf48 line 42

even more tests, fixed severe bug with autoescaping.Armin Ronacherbefore adoption5411ce7

line 49why, one step back
49'''