Refs #29983 -- Added support for using pathlib.Path in all settings.

This commit is contained in:
Jon Dufresne 2019-11-07 01:26:22 -08:00 committed by Carlton Gibson
parent 367634f976
commit 77aa74cb70
18 changed files with 118 additions and 10 deletions

View file

@ -1,3 +1,5 @@
from pathlib import Path
from template_tests.test_response import test_processor_name
from django.template import Context, EngineHandler, RequestContext
@ -164,3 +166,13 @@ class DjangoTemplatesTests(TemplateStringsTests):
def test_debug_default_template_loaders(self):
engine = DjangoTemplates({'DIRS': [], 'APP_DIRS': True, 'NAME': 'django', 'OPTIONS': {}})
self.assertEqual(engine.engine.loaders, self.default_loaders)
def test_dirs_pathlib(self):
engine = DjangoTemplates({
'DIRS': [Path(__file__).parent / 'templates' / 'template_backends'],
'APP_DIRS': False,
'NAME': 'django',
'OPTIONS': {},
})
template = engine.get_template('hello.html')
self.assertEqual(template.render({'name': 'Joe'}), 'Hello Joe!\n')