[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2021-09-10 11:12:25 +00:00
parent 15a0e66219
commit 0648ad9a93
14 changed files with 983 additions and 432 deletions

View file

@ -8,16 +8,20 @@ from django_components.middleware import ComponentDependencyMiddleware
# Create middleware instance
response_stash = None
middleware = ComponentDependencyMiddleware(get_response=lambda _: response_stash)
middleware = ComponentDependencyMiddleware(
get_response=lambda _: response_stash
)
class Django30CompatibleSimpleTestCase(SimpleTestCase):
def assertHTMLEqual(self, left, right):
left = left.replace(' type="text/javascript"', '')
super(Django30CompatibleSimpleTestCase, self).assertHTMLEqual(left, right)
left = left.replace(' type="text/javascript"', "")
super(Django30CompatibleSimpleTestCase, self).assertHTMLEqual(
left, right
)
def assertInHTML(self, needle, haystack, count=None, msg_prefix=''):
haystack = haystack.replace(' type="text/javascript"', '')
def assertInHTML(self, needle, haystack, count=None, msg_prefix=""):
haystack = haystack.replace(' type="text/javascript"', "")
super().assertInHTML(needle, haystack, count, msg_prefix)
@ -29,7 +33,9 @@ request = Mock()
mock_template = Mock()
def create_and_process_template_response(template, context=None, use_middleware=True):
def create_and_process_template_response(
template, context=None, use_middleware=True
):
context = context if context is not None else Context({})
mock_template.render = lambda context, _: template.render(context)
response = TemplateResponse(request, mock_template, context)
@ -40,4 +46,4 @@ def create_and_process_template_response(template, context=None, use_middleware=
response = middleware(request)
else:
response.render()
return response.content.decode('utf-8')
return response.content.decode("utf-8")