mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed E128 flake8 warnings in tests/.
This commit is contained in:
parent
df8d8d4292
commit
92053acbb9
148 changed files with 2073 additions and 2248 deletions
|
@ -140,8 +140,10 @@ class DebugViewTests(LoggingCaptureMixin, SimpleTestCase):
|
|||
match = re.search(b'<div class="context" id="(?P<id>[^"]+)">', response.content)
|
||||
self.assertIsNotNone(match)
|
||||
id_repr = match.group('id')
|
||||
self.assertFalse(re.search(b'[^c0-9]', id_repr),
|
||||
"Numeric IDs in debug response HTML page shouldn't be localized (value: %s)." % id_repr)
|
||||
self.assertFalse(
|
||||
re.search(b'[^c0-9]', id_repr),
|
||||
"Numeric IDs in debug response HTML page shouldn't be localized (value: %s)." % id_repr
|
||||
)
|
||||
|
||||
def test_template_exceptions(self):
|
||||
for n in range(len(except_args)):
|
||||
|
@ -149,9 +151,11 @@ class DebugViewTests(LoggingCaptureMixin, SimpleTestCase):
|
|||
self.client.get(reverse('template_exception', args=(n,)))
|
||||
except Exception:
|
||||
raising_loc = inspect.trace()[-1][-2][0].strip()
|
||||
self.assertNotEqual(raising_loc.find('raise BrokenException'), -1,
|
||||
"Failed to find 'raise BrokenException' in last frame of traceback, instead found: %s" %
|
||||
raising_loc)
|
||||
self.assertNotEqual(
|
||||
raising_loc.find('raise BrokenException'), -1,
|
||||
"Failed to find 'raise BrokenException' in last frame of "
|
||||
"traceback, instead found: %s" % raising_loc
|
||||
)
|
||||
|
||||
def test_template_loader_postmortem(self):
|
||||
"""Tests for not existing file"""
|
||||
|
@ -939,12 +943,10 @@ class AjaxResponseExceptionReporterFilter(ExceptionReportTestMixin, LoggingCaptu
|
|||
the request to bypass the one set in DEFAULT_EXCEPTION_REPORTER_FILTER.
|
||||
"""
|
||||
with self.settings(DEBUG=True):
|
||||
self.verify_unsafe_response(custom_exception_reporter_filter_view,
|
||||
check_for_vars=False)
|
||||
self.verify_unsafe_response(custom_exception_reporter_filter_view, check_for_vars=False)
|
||||
|
||||
with self.settings(DEBUG=False):
|
||||
self.verify_unsafe_response(custom_exception_reporter_filter_view,
|
||||
check_for_vars=False)
|
||||
self.verify_unsafe_response(custom_exception_reporter_filter_view, check_for_vars=False)
|
||||
|
||||
|
||||
class HelperFunctionTests(SimpleTestCase):
|
||||
|
|
|
@ -329,8 +329,7 @@ class JsI18NTestsMultiPackage(SimpleTestCase):
|
|||
with self.settings(LANGUAGE_CODE='es-ar', LOCALE_PATHS=extended_locale_paths):
|
||||
with override('es-ar'):
|
||||
response = self.client.get('/jsi18n/')
|
||||
self.assertContains(response,
|
||||
'este texto de app3 debe ser traducido')
|
||||
self.assertContains(response, 'este texto de app3 debe ser traducido')
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='view_tests.urls')
|
||||
|
@ -344,7 +343,7 @@ class JavascriptI18nTests(SeleniumTestCase):
|
|||
|
||||
@override_settings(LANGUAGE_CODE='de')
|
||||
def test_javascript_gettext(self):
|
||||
self.selenium.get('%s%s' % (self.live_server_url, '/jsi18n_template/'))
|
||||
self.selenium.get(self.live_server_url + '/jsi18n_template/')
|
||||
|
||||
elem = self.selenium.find_element_by_id("gettext")
|
||||
self.assertEqual(elem.text, "Entfernen")
|
||||
|
@ -362,7 +361,7 @@ class JavascriptI18nTests(SeleniumTestCase):
|
|||
@modify_settings(INSTALLED_APPS={'append': ['view_tests.app1', 'view_tests.app2']})
|
||||
@override_settings(LANGUAGE_CODE='fr')
|
||||
def test_multiple_catalogs(self):
|
||||
self.selenium.get('%s%s' % (self.live_server_url, '/jsi18n_multi_catalogs/'))
|
||||
self.selenium.get(self.live_server_url + '/jsi18n_multi_catalogs/')
|
||||
|
||||
elem = self.selenium.find_element_by_id('app1string')
|
||||
self.assertEqual(elem.text, 'il faut traduire cette chaîne de caractères de app1')
|
||||
|
|
|
@ -56,8 +56,10 @@ class StaticTests(SimpleTestCase):
|
|||
|
||||
def test_is_modified_since(self):
|
||||
file_name = 'file.txt'
|
||||
response = self.client.get('/%s/%s' % (self.prefix, file_name),
|
||||
HTTP_IF_MODIFIED_SINCE='Thu, 1 Jan 1970 00:00:00 GMT')
|
||||
response = self.client.get(
|
||||
'/%s/%s' % (self.prefix, file_name),
|
||||
HTTP_IF_MODIFIED_SINCE='Thu, 1 Jan 1970 00:00:00 GMT'
|
||||
)
|
||||
response_content = b''.join(response)
|
||||
with open(path.join(media_dir, file_name), 'rb') as fp:
|
||||
self.assertEqual(fp.read(), response_content)
|
||||
|
|
|
@ -113,12 +113,10 @@ def send_log(request, exc_info):
|
|||
orig_filters = admin_email_handler.filters
|
||||
admin_email_handler.filters = []
|
||||
admin_email_handler.include_html = True
|
||||
logger.error('Internal Server Error: %s', request.path,
|
||||
logger.error(
|
||||
'Internal Server Error: %s', request.path,
|
||||
exc_info=exc_info,
|
||||
extra={
|
||||
'status_code': 500,
|
||||
'request': request
|
||||
}
|
||||
extra={'status_code': 500, 'request': request},
|
||||
)
|
||||
admin_email_handler.filters = orig_filters
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue