mirror of
https://github.com/django/django.git
synced 2025-08-02 18:13:02 +00:00
Refs #24121 -- Added __repr__() to Engine
This commit is contained in:
parent
55775891fb
commit
c609d5149c
2 changed files with 57 additions and 0 deletions
|
@ -10,6 +10,43 @@ from .utils import ROOT, TEMPLATE_DIR
|
|||
OTHER_DIR = os.path.join(ROOT, 'other_templates')
|
||||
|
||||
|
||||
class EngineTest(SimpleTestCase):
|
||||
def test_repr_empty(self):
|
||||
engine = Engine()
|
||||
self.assertEqual(
|
||||
repr(engine),
|
||||
"<Engine: app_dirs=False debug=False loaders=[("
|
||||
"'django.template.loaders.cached.Loader', "
|
||||
"['django.template.loaders.filesystem.Loader'])] "
|
||||
"string_if_invalid='' file_charset='utf-8' builtins=["
|
||||
"'django.template.defaulttags', 'django.template.defaultfilters', "
|
||||
"'django.template.loader_tags'] autoescape=True>"
|
||||
)
|
||||
|
||||
def test_repr(self):
|
||||
engine = Engine(
|
||||
dirs=[TEMPLATE_DIR],
|
||||
context_processors=['django.template.context_processors.debug'],
|
||||
debug=True,
|
||||
loaders=['django.template.loaders.filesystem.Loader'],
|
||||
string_if_invalid='x',
|
||||
file_charset='utf-16',
|
||||
libraries={'custom': 'template_tests.templatetags.custom'},
|
||||
autoescape=False,
|
||||
)
|
||||
self.assertEqual(
|
||||
repr(engine),
|
||||
f"<Engine: dirs=[{TEMPLATE_DIR!r}] app_dirs=False "
|
||||
"context_processors=['django.template.context_processors.debug'] "
|
||||
"debug=True loaders=['django.template.loaders.filesystem.Loader'] "
|
||||
"string_if_invalid='x' file_charset='utf-16' "
|
||||
"libraries={'custom': 'template_tests.templatetags.custom'} "
|
||||
"builtins=['django.template.defaulttags', "
|
||||
"'django.template.defaultfilters', 'django.template.loader_tags'] "
|
||||
"autoescape=False>"
|
||||
)
|
||||
|
||||
|
||||
class RenderToStringTest(SimpleTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue