1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

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,4 @@
from pathlib import Path
from unittest import skipIf
from django.template import TemplateSyntaxError
@@ -85,3 +86,13 @@ class Jinja2Tests(TemplateStringsTests):
with self.settings(STATIC_URL='/s/'):
content = template.render(request=request)
self.assertEqual(content, 'Static URL: /s/')
def test_dirs_pathlib(self):
engine = Jinja2({
'DIRS': [Path(__file__).parent / 'templates' / 'template_backends'],
'APP_DIRS': False,
'NAME': 'jinja2',
'OPTIONS': {},
})
template = engine.get_template('hello.html')
self.assertEqual(template.render({'name': 'Joe'}), 'Hello Joe!')