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

Refs #33476 -- Reformatted code with Black.

This commit is contained in:
django-bot
2022-02-03 20:24:19 +01:00
committed by Mariusz Felisiak
parent f68fa8b45d
commit 9c19aff7c7
1992 changed files with 139577 additions and 96284 deletions

View File

@@ -6,7 +6,7 @@ from django.test.utils import override_settings
from django.utils.safestring import mark_safe
ROOT = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_DIR = os.path.join(ROOT, 'templates')
TEMPLATE_DIR = os.path.join(ROOT, "templates")
def setup(templates, *args, test_once=False):
@@ -34,9 +34,12 @@ def setup(templates, *args, test_once=False):
templates["inclusion.html"] = "{{ result }}"
loaders = [
('django.template.loaders.cached.Loader', [
('django.template.loaders.locmem.Loader', templates),
]),
(
"django.template.loaders.cached.Loader",
[
("django.template.loaders.locmem.Loader", templates),
],
),
]
def decorator(func):
@@ -46,7 +49,7 @@ def setup(templates, *args, test_once=False):
@functools.wraps(func)
def inner(self):
# Set up custom template tag libraries if specified
libraries = getattr(self, 'libraries', {})
libraries = getattr(self, "libraries", {})
self.engine = Engine(
libraries=libraries,
@@ -60,7 +63,7 @@ def setup(templates, *args, test_once=False):
self.engine = Engine(
libraries=libraries,
loaders=loaders,
string_if_invalid='INVALID',
string_if_invalid="INVALID",
)
func(self)
func(self)
@@ -98,7 +101,7 @@ class SomeClass:
self.otherclass = OtherClass()
def method(self):
return 'SomeClass.method'
return "SomeClass.method"
def method2(self, o):
return o
@@ -113,9 +116,9 @@ class SomeClass:
raise TypeError
def __getitem__(self, key):
if key == 'silent_fail_key':
if key == "silent_fail_key":
raise SomeException
elif key == 'noisy_fail_key':
elif key == "noisy_fail_key":
raise SomeOtherException
raise KeyError
@@ -138,7 +141,7 @@ class SomeClass:
class OtherClass:
def method(self):
return 'OtherClass.method'
return "OtherClass.method"
class TestObj:
@@ -160,21 +163,23 @@ class SilentGetItemClass:
class SilentAttrClass:
def b(self):
raise SomeException
b = property(b)
class UTF8Class:
"Class whose __str__ returns non-ASCII data"
def __str__(self):
return 'ŠĐĆŽćžšđ'
return "ŠĐĆŽćžšđ"
# These two classes are used to test auto-escaping of string output.
class UnsafeClass:
def __str__(self):
return 'you & me'
return "you & me"
class SafeClass:
def __str__(self):
return mark_safe('you > me')
return mark_safe("you > me")