summaryrefslogtreecommitdiff
path: root/tests/template_backends/test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/template_backends/test_utils.py')
-rw-r--r--tests/template_backends/test_utils.py36
1 files changed, 22 insertions, 14 deletions
diff --git a/tests/template_backends/test_utils.py b/tests/template_backends/test_utils.py
index d0bd01cdc2..15dbaae818 100644
--- a/tests/template_backends/test_utils.py
+++ b/tests/template_backends/test_utils.py
@@ -4,8 +4,7 @@ from django.test import SimpleTestCase, override_settings
class TemplateUtilsTests(SimpleTestCase):
-
- @override_settings(TEMPLATES=[{'BACKEND': 'raise.import.error'}])
+ @override_settings(TEMPLATES=[{"BACKEND": "raise.import.error"}])
def test_backend_import_error(self):
"""
Failing to import a backend keeps raising the original import error
@@ -16,28 +15,37 @@ class TemplateUtilsTests(SimpleTestCase):
with self.assertRaisesMessage(ImportError, "No module named 'raise"):
engines.all()
- @override_settings(TEMPLATES=[{
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- # Incorrect: APP_DIRS and loaders are mutually incompatible.
- 'APP_DIRS': True,
- 'OPTIONS': {'loaders': []},
- }])
+ @override_settings(
+ TEMPLATES=[
+ {
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
+ # Incorrect: APP_DIRS and loaders are mutually incompatible.
+ "APP_DIRS": True,
+ "OPTIONS": {"loaders": []},
+ }
+ ]
+ )
def test_backend_improperly_configured(self):
"""
Failing to initialize a backend keeps raising the original exception
(#24265).
"""
- msg = 'app_dirs must not be set when loaders is defined.'
+ msg = "app_dirs must not be set when loaders is defined."
with self.assertRaisesMessage(ImproperlyConfigured, msg):
engines.all()
with self.assertRaisesMessage(ImproperlyConfigured, msg):
engines.all()
- @override_settings(TEMPLATES=[{
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- }, {
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- }])
+ @override_settings(
+ TEMPLATES=[
+ {
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
+ },
+ {
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
+ },
+ ]
+ )
def test_backend_names_must_be_unique(self):
msg = (
"Template engine aliases aren't unique, duplicates: django. Set "