mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #29983 -- Added support for using pathlib.Path in all settings.
This commit is contained in:
committed by
Carlton Gibson
parent
367634f976
commit
77aa74cb70
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user