Isolated template tests from Django settings.

This commit is contained in:
Aymeric Augustin 2014-12-07 09:43:10 +01:00
parent b34b8a12b7
commit 92a2d049a2
85 changed files with 1070 additions and 1081 deletions

View file

@ -1,10 +1,9 @@
from unittest import skipIf
import warnings
from django.conf import settings
from django.test import SimpleTestCase
from ..utils import render, setup
from ..utils import setup
try:
import numpy
@ -28,7 +27,7 @@ class NumpyTests(SimpleTestCase):
Numpy's array-index syntax allows a template to access a certain
item of a subscriptable object.
"""
output = render(
output = self.engine.render_to_string(
'numpy-array-index01',
{'var': numpy.array(["first item", "second item"])},
)
@ -39,11 +38,11 @@ class NumpyTests(SimpleTestCase):
"""
Fail silently when the array index is out of range.
"""
output = render(
output = self.engine.render_to_string(
'numpy-array-index02',
{'var': numpy.array(["first item", "second item"])},
)
if settings.TEMPLATE_STRING_IF_INVALID:
if self.engine.string_if_invalid:
self.assertEqual(output, 'INVALID')
else:
self.assertEqual(output, '')