mirror of
https://github.com/django/django.git
synced 2025-08-02 10:02:41 +00:00
Isolated template tests from Django settings.
This commit is contained in:
parent
b34b8a12b7
commit
92a2d049a2
85 changed files with 1070 additions and 1081 deletions
|
@ -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, '')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue