summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPreston Timmons <prestontimmons@gmail.com>2015-02-21 13:20:20 -0600
committerTim Graham <timograham@gmail.com>2015-02-24 09:22:15 -0500
commit2e7414cdf4712f72b9b87bc8ee3ff8bfc1bef677 (patch)
tree394d26ea79fddbb8e090de85b45d9ee11a9d7c52
parente15292daa04110f59dcb7515221e22d576437bb2 (diff)
[1.8.x] Moved test_token_smart_split into ParserTests.
Backport of 25a0b5cdcd5e70a6563116639a477b915ee5784e from master
-rw-r--r--tests/template_tests/test_parser.py11
-rw-r--r--tests/template_tests/tests.py9
2 files changed, 11 insertions, 9 deletions
diff --git a/tests/template_tests/test_parser.py b/tests/template_tests/test_parser.py
index 5d9a3a374e..0c5198fb64 100644
--- a/tests/template_tests/test_parser.py
+++ b/tests/template_tests/test_parser.py
@@ -7,13 +7,22 @@ from unittest import TestCase
from django.template import Library, Template, TemplateSyntaxError
from django.template.base import (
- FilterExpression, Parser, TokenParser, Variable,
+ TOKEN_BLOCK, FilterExpression, Parser, Token, TokenParser, Variable,
)
from django.test import override_settings
from django.utils import six
class ParserTests(TestCase):
+
+ def test_token_smart_split(self):
+ """
+ #7027 -- _() syntax should work with spaces
+ """
+ token = Token(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")'])
+
def test_token_parsing(self):
# Tests for TokenParser behavior in the face of quoted strings with
# spaces.
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py
index 74fa1e22fc..2bb093af06 100644
--- a/tests/template_tests/tests.py
+++ b/tests/template_tests/tests.py
@@ -7,8 +7,7 @@ import sys
from django.contrib.auth.models import Group
from django.core import urlresolvers
from django.template import (
- Context, Template, TemplateSyntaxError, base as template_base, engines,
- loader,
+ Context, Template, TemplateSyntaxError, engines, loader,
)
from django.test import SimpleTestCase, override_settings
from django.utils._os import upath
@@ -26,12 +25,6 @@ class TemplateTests(SimpleTestCase):
class TemplateRegressionTests(SimpleTestCase):
- def test_token_smart_split(self):
- # Regression test for #7027
- 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")'])
-
@override_settings(SETTINGS_MODULE=None, DEBUG=True)
def test_url_reverse_no_settings_module(self):
# Regression test for #9005