1
0
mirror of https://github.com/django/django.git synced 2024-12-26 11:06:07 +00:00

[1.8.x] Refs #24538 -- Simplified a test per Aymeric's feedback.

Backport of a184a99123 from master
This commit is contained in:
Tim Graham 2015-04-01 13:08:43 -04:00
parent 5c63c45512
commit 5a4f95805f

View File

@ -30,18 +30,11 @@ class Jinja2Tests(TemplateStringsTests):
def test_self_context(self): def test_self_context(self):
""" """
#24538 -- Using 'self' in the context should not throw errors Using 'self' in the context should not throw errors (#24538).
""" """
engine = Jinja2({
'DIRS': [],
'APP_DIRS': False,
'NAME': 'django',
'OPTIONS': {},
})
# self will be overridden to be a TemplateReference, so the self # self will be overridden to be a TemplateReference, so the self
# variable will not come through. Attempting to use one though should # variable will not come through. Attempting to use one though should
# not throw an error. # not throw an error.
template = engine.from_string('hello {{ foo }}!') template = self.engine.from_string('hello {{ foo }}!')
content = template.render(context={'self': 'self', 'foo': 'world'}) content = template.render(context={'self': 'self', 'foo': 'world'})
self.assertEqual(content, 'hello world!') self.assertEqual(content, 'hello world!')