diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-11-10 21:40:26 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-12-28 14:47:31 +0100 |
| commit | 7eefdbf7ab9f5bafe5baae2b877d93efc90e3044 (patch) | |
| tree | 4b9430487a775ad62415d983d56531cee7f5d0d1 /tests | |
| parent | bfa21ddf7649799a2254b50cb83eb5276cb7f129 (diff) | |
Cleaned up the django.template namespace.
Since this package is going to hold both the implementation of the Django
Template Language and the infrastructure for Multiple Template Engines,
it should be untied from the DTL as much as possible within our
backwards-compatibility policy.
Only public APIs (i.e. APIs mentioned in the documentation) were left.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/template_tests/test_nodelist.py | 3 | ||||
| -rw-r--r-- | tests/template_tests/test_parser.py | 4 | ||||
| -rw-r--r-- | tests/template_tests/test_unicode.py | 3 | ||||
| -rw-r--r-- | tests/template_tests/tests.py | 5 | ||||
| -rw-r--r-- | tests/template_tests/utils.py | 10 |
5 files changed, 15 insertions, 10 deletions
diff --git a/tests/template_tests/test_nodelist.py b/tests/template_tests/test_nodelist.py index bce75aeecb..836d1b6db9 100644 --- a/tests/template_tests/test_nodelist.py +++ b/tests/template_tests/test_nodelist.py @@ -1,6 +1,7 @@ from unittest import TestCase -from django.template import Context, Template, VariableNode +from django.template import Context, Template +from django.template.base import VariableNode from django.test import override_settings diff --git a/tests/template_tests/test_parser.py b/tests/template_tests/test_parser.py index 017e78a863..348428513b 100644 --- a/tests/template_tests/test_parser.py +++ b/tests/template_tests/test_parser.py @@ -5,8 +5,8 @@ from __future__ import unicode_literals from unittest import TestCase -from django.template import (TokenParser, FilterExpression, Parser, Variable, - Template, TemplateSyntaxError, Library) +from django.template import Library, Template, TemplateSyntaxError +from django.template.base import FilterExpression, Parser, TokenParser, Variable from django.test import override_settings from django.utils import six diff --git a/tests/template_tests/test_unicode.py b/tests/template_tests/test_unicode.py index 1f333bfed2..02d3d0a51d 100644 --- a/tests/template_tests/test_unicode.py +++ b/tests/template_tests/test_unicode.py @@ -3,7 +3,8 @@ from __future__ import unicode_literals from unittest import TestCase -from django.template import Template, TemplateEncodingError, Context +from django.template import Template, Context +from django.template.base import TemplateEncodingError from django.utils.safestring import SafeData from django.utils import six diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py index 2ba1cdb18a..80f926ea6f 100644 --- a/tests/template_tests/tests.py +++ b/tests/template_tests/tests.py @@ -8,7 +8,8 @@ import unittest from django import template from django.contrib.auth.models import Group from django.core import urlresolvers -from django.template import loader, Context, RequestContext, Template, TemplateSyntaxError +from django.template import (base as template_base, loader, + Context, RequestContext, Template, TemplateSyntaxError) from django.template.engine import Engine from django.template.loaders import app_directories, filesystem from django.test import RequestFactory, SimpleTestCase @@ -245,7 +246,7 @@ class TemplateRegressionTests(SimpleTestCase): def test_token_smart_split(self): # Regression test for #7027 - token = template.Token(template.TOKEN_BLOCK, 'sometag _("Page not found") value|yesno:_("yes,no")') + token = template_base.Token(template_base.TOKEN_BLOCK, 'sometag _("Page not found") value|yesno:_("yes,no")') split = token.split_contents() self.assertEqual(split, ["sometag", '_("Page not found")', 'value|yesno:_("yes,no")']) diff --git a/tests/template_tests/utils.py b/tests/template_tests/utils.py index 168eca73f8..ba8dcdd46f 100644 --- a/tests/template_tests/utils.py +++ b/tests/template_tests/utils.py @@ -6,7 +6,7 @@ import functools from django import template from django.template import Library -from django.template.base import Context +from django.template.base import Context, libraries from django.template.engine import Engine from django.template.loader import get_template from django.test.utils import override_settings @@ -100,9 +100,11 @@ def upper(value): def register_test_tags(func): @functools.wraps(func) def inner(self): - template.libraries['testtags'] = register - func(self) - del template.libraries['testtags'] + libraries['testtags'] = register + try: + func(self) + finally: + del libraries['testtags'] return inner |
