summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests/test_firstof.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-12-07 09:43:10 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-12-28 16:23:01 +0100
commit92a2d049a253fb499db88efb6cf6c9209f6f251c (patch)
treebd3c913883b36f918f3c8ae7af942a8c8f50a23f /tests/template_tests/syntax_tests/test_firstof.py
parentb34b8a12b7f657f379c9e0e5ee7688bf36e242d2 (diff)
Isolated template tests from Django settings.
Diffstat (limited to 'tests/template_tests/syntax_tests/test_firstof.py')
-rw-r--r--tests/template_tests/syntax_tests/test_firstof.py33
1 files changed, 16 insertions, 17 deletions
diff --git a/tests/template_tests/syntax_tests/test_firstof.py b/tests/template_tests/syntax_tests/test_firstof.py
index 3c8291849b..c7c4434446 100644
--- a/tests/template_tests/syntax_tests/test_firstof.py
+++ b/tests/template_tests/syntax_tests/test_firstof.py
@@ -1,77 +1,76 @@
import warnings
-from django.template.base import TemplateSyntaxError
-from django.template.loader import get_template
+from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from django.utils.deprecation import RemovedInDjango20Warning
-from ..utils import render, setup
+from ..utils import setup
class FirstOfTagTests(SimpleTestCase):
@setup({'firstof01': '{% firstof a b c %}'})
def test_firstof01(self):
- output = render('firstof01', {'a': 0, 'c': 0, 'b': 0})
+ output = self.engine.render_to_string('firstof01', {'a': 0, 'c': 0, 'b': 0})
self.assertEqual(output, '')
@setup({'firstof02': '{% firstof a b c %}'})
def test_firstof02(self):
- output = render('firstof02', {'a': 1, 'c': 0, 'b': 0})
+ output = self.engine.render_to_string('firstof02', {'a': 1, 'c': 0, 'b': 0})
self.assertEqual(output, '1')
@setup({'firstof03': '{% firstof a b c %}'})
def test_firstof03(self):
- output = render('firstof03', {'a': 0, 'c': 0, 'b': 2})
+ output = self.engine.render_to_string('firstof03', {'a': 0, 'c': 0, 'b': 2})
self.assertEqual(output, '2')
@setup({'firstof04': '{% firstof a b c %}'})
def test_firstof04(self):
- output = render('firstof04', {'a': 0, 'c': 3, 'b': 0})
+ output = self.engine.render_to_string('firstof04', {'a': 0, 'c': 3, 'b': 0})
self.assertEqual(output, '3')
@setup({'firstof05': '{% firstof a b c %}'})
def test_firstof05(self):
- output = render('firstof05', {'a': 1, 'c': 3, 'b': 2})
+ output = self.engine.render_to_string('firstof05', {'a': 1, 'c': 3, 'b': 2})
self.assertEqual(output, '1')
@setup({'firstof06': '{% firstof a b c %}'})
def test_firstof06(self):
- output = render('firstof06', {'c': 3, 'b': 0})
+ output = self.engine.render_to_string('firstof06', {'c': 3, 'b': 0})
self.assertEqual(output, '3')
@setup({'firstof07': '{% firstof a b "c" %}'})
def test_firstof07(self):
- output = render('firstof07', {'a': 0})
+ output = self.engine.render_to_string('firstof07', {'a': 0})
self.assertEqual(output, 'c')
@setup({'firstof08': '{% firstof a b "c and d" %}'})
def test_firstof08(self):
- output = render('firstof08', {'a': 0, 'b': 0})
+ output = self.engine.render_to_string('firstof08', {'a': 0, 'b': 0})
self.assertEqual(output, 'c and d')
@setup({'firstof09': '{% firstof %}'})
def test_firstof09(self):
with self.assertRaises(TemplateSyntaxError):
- get_template('firstof09')
+ self.engine.get_template('firstof09')
@setup({'firstof10': '{% firstof a %}'})
def test_firstof10(self):
- output = render('firstof10', {'a': '<'})
+ output = self.engine.render_to_string('firstof10', {'a': '<'})
self.assertEqual(output, '&lt;')
@setup({'firstof11': '{% load firstof from future %}{% firstof a b %}'})
def test_firstof11(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore", RemovedInDjango20Warning)
- output = render('firstof11', {'a': '<', 'b': '>'})
+ output = self.engine.render_to_string('firstof11', {'a': '<', 'b': '>'})
self.assertEqual(output, '&lt;')
@setup({'firstof12': '{% load firstof from future %}{% firstof a b %}'})
def test_firstof12(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore", RemovedInDjango20Warning)
- output = render('firstof12', {'a': '', 'b': '>'})
+ output = self.engine.render_to_string('firstof12', {'a': '', 'b': '>'})
self.assertEqual(output, '&gt;')
@setup({'firstof13': '{% load firstof from future %}'
@@ -79,12 +78,12 @@ class FirstOfTagTests(SimpleTestCase):
def test_firstof13(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore", RemovedInDjango20Warning)
- output = render('firstof13', {'a': '<'})
+ output = self.engine.render_to_string('firstof13', {'a': '<'})
self.assertEqual(output, '<')
@setup({'firstof14': '{% load firstof from future %}{% firstof a|safe b %}'})
def test_firstof14(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore", RemovedInDjango20Warning)
- output = render('firstof14', {'a': '<'})
+ output = self.engine.render_to_string('firstof14', {'a': '<'})
self.assertEqual(output, '<')