1
0
mirror of https://github.com/django/django.git synced 2024-12-26 19:16:11 +00:00
django/tests/template_tests/syntax_tests/test_verbatim.py
Ramiro Morales 16f26defa7 Converted recently refactored templates tests to SimpleTestCase.
These test methods don't need DB setup/teardown.

Refs #23768 and b872134b.
2014-12-03 18:56:46 -05:00

40 lines
1.6 KiB
Python

from django.template.base import TemplateSyntaxError
from django.template.loader import get_template
from django.test import SimpleTestCase
from .utils import render, setup
class VerbatimTagTests(SimpleTestCase):
@setup({'verbatim-tag01': '{% verbatim %}{{bare }}{% endverbatim %}'})
def test_verbatim_tag01(self):
output = render('verbatim-tag01')
self.assertEqual(output, '{{bare }}')
@setup({'verbatim-tag02': '{% verbatim %}{% endif %}{% endverbatim %}'})
def test_verbatim_tag02(self):
output = render('verbatim-tag02')
self.assertEqual(output, '{% endif %}')
@setup({'verbatim-tag03': '{% verbatim %}It\'s the {% verbatim %} tag{% endverbatim %}'})
def test_verbatim_tag03(self):
output = render('verbatim-tag03')
self.assertEqual(output, 'It\'s the {% verbatim %} tag')
@setup({'verbatim-tag04': '{% verbatim %}{% verbatim %}{% endverbatim %}{% endverbatim %}'})
def test_verbatim_tag04(self):
with self.assertRaises(TemplateSyntaxError):
get_template('verbatim-tag04')
@setup({'verbatim-tag05': '{% verbatim %}{% endverbatim %}{% verbatim %}{% endverbatim %}'})
def test_verbatim_tag05(self):
output = render('verbatim-tag05')
self.assertEqual(output, '')
@setup({'verbatim-tag06': '{% verbatim special %}'
'Don\'t {% endverbatim %} just yet{% endverbatim special %}'})
def test_verbatim_tag06(self):
output = render('verbatim-tag06')
self.assertEqual(output, 'Don\'t {% endverbatim %} just yet')