Replaced TOKEN_* constants by TokenType enums.

Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz 2018-05-10 17:51:51 +02:00 committed by GitHub
parent 1e20fedb35
commit 9c4ea63e87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 44 deletions

View file

@ -3,7 +3,7 @@ Testing some internals of the template processing. These are *not* examples to b
"""
from django.template import Library, TemplateSyntaxError
from django.template.base import (
TOKEN_BLOCK, FilterExpression, Parser, Token, Variable,
FilterExpression, Parser, Token, TokenType, Variable,
)
from django.template.defaultfilters import register as filter_library
from django.test import SimpleTestCase
@ -15,7 +15,7 @@ class ParserTests(SimpleTestCase):
"""
#7027 -- _() syntax should work with spaces
"""
token = Token(TOKEN_BLOCK, 'sometag _("Page not found") value|yesno:_("yes,no")')
token = Token(TokenType.BLOCK, 'sometag _("Page not found") value|yesno:_("yes,no")')
split = token.split_contents()
self.assertEqual(split, ["sometag", '_("Page not found")', 'value|yesno:_("yes,no")'])