mirror of
https://github.com/django/django.git
synced 2025-08-02 10:02:41 +00:00
Refs #29983 -- Added support for using pathlib.Path in all settings.
This commit is contained in:
parent
367634f976
commit
77aa74cb70
18 changed files with 118 additions and 10 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue