From 7119f40c9881666b6f9b5cf7df09ee1d21cc8344 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Fri, 4 Feb 2022 08:08:27 +0100 Subject: Refs #33476 -- Refactored code to strictly match 88 characters line length. --- tests/view_tests/tests/test_csrf.py | 4 +++- tests/view_tests/tests/test_debug.py | 21 ++++++++++++++------- tests/view_tests/tests/test_defaults.py | 7 +++++-- tests/view_tests/tests/test_i18n.py | 3 ++- tests/view_tests/views.py | 24 ++++++++++++------------ 5 files changed, 36 insertions(+), 23 deletions(-) (limited to 'tests/view_tests') diff --git a/tests/view_tests/tests/test_csrf.py b/tests/view_tests/tests/test_csrf.py index c0f812431d..2f4542c143 100644 --- a/tests/view_tests/tests/test_csrf.py +++ b/tests/view_tests/tests/test_csrf.py @@ -96,7 +96,9 @@ class CsrfViewTests(SimpleTestCase): ( "django.template.loaders.locmem.Loader", { - CSRF_FAILURE_TEMPLATE_NAME: "Test template for CSRF failure" + CSRF_FAILURE_TEMPLATE_NAME: ( + "Test template for CSRF failure" + ) }, ), ], diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py index 1bf395ce37..5a07131349 100644 --- a/tests/view_tests/tests/test_debug.py +++ b/tests/view_tests/tests/test_debug.py @@ -127,7 +127,10 @@ class DebugViewTests(SimpleTestCase): ( "django.template.loaders.locmem.Loader", { - "403.html": "This is a test template for a 403 error ({{ exception }}).", + "403.html": ( + "This is a test template for a 403 error " + "({{ exception }})." + ), }, ), ], @@ -259,13 +262,15 @@ class DebugViewTests(SimpleTestCase): def test_non_l10ned_numeric_ids(self): """ - Numeric IDs and fancy traceback context blocks line numbers shouldn't be localized. + Numeric IDs and fancy traceback context blocks line numbers shouldn't + be localized. """ with self.settings(DEBUG=True): with self.assertLogs("django.request", "ERROR"): response = self.client.get("/raises500/") # We look for a HTML fragment of the form - # '
', not '
', + # not '
', response.content @@ -274,8 +279,8 @@ class DebugViewTests(SimpleTestCase): id_repr = match["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.decode(), + "Numeric IDs in debug response HTML page shouldn't be localized " + "(value: %s)." % id_repr.decode(), ) def test_template_exceptions(self): @@ -791,7 +796,8 @@ class ExceptionReporterTests(SimpleTestCase): html, ) self.assertIn( - '"generated", line 2, in funcName\n <source code not available>', + '"generated", line 2, in funcName\n' + " <source code not available>", html, ) text = reporter.get_traceback_text() @@ -903,7 +909,8 @@ class ExceptionReporterTests(SimpleTestCase): exc_type, exc_value, tb = sys.exc_info() html = ExceptionReporter(None, exc_type, exc_value, tb).get_traceback_html() self.assertIn( - '
'<p>Local variable</p>'
', + '
'<p>Local variable</p>'
' + "", html, ) diff --git a/tests/view_tests/tests/test_defaults.py b/tests/view_tests/tests/test_defaults.py index 0c4fc7c7da..f99066e5bb 100644 --- a/tests/view_tests/tests/test_defaults.py +++ b/tests/view_tests/tests/test_defaults.py @@ -111,8 +111,11 @@ class DefaultsTests(TestCase): ( "django.template.loaders.locmem.Loader", { - "404.html": "This is a test template for a 404 error " - "(path: {{ request_path }}, exception: {{ exception }}).", + "404.html": ( + "This is a test template for a 404 error " + "(path: {{ request_path }}, " + "exception: {{ exception }})." + ), "500.html": "This is a test template for a 500 error.", }, ), diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py index 6c8e0f8c91..3aacded7c6 100644 --- a/tests/view_tests/tests/test_i18n.py +++ b/tests/view_tests/tests/test_i18n.py @@ -518,7 +518,8 @@ class I18nSeleniumTests(SeleniumTestCase): elem = self.selenium.find_element(By.ID, "formats") self.assertEqual( elem.text, - "DATE_INPUT_FORMATS is an object; DECIMAL_SEPARATOR is a string; FIRST_DAY_OF_WEEK is a number;", + "DATE_INPUT_FORMATS is an object; DECIMAL_SEPARATOR is a string; " + "FIRST_DAY_OF_WEEK is a number;", ) @modify_settings(INSTALLED_APPS={"append": ["view_tests.app1", "view_tests.app2"]}) diff --git a/tests/view_tests/views.py b/tests/view_tests/views.py index 43057af3a1..a9eeee3cd2 100644 --- a/tests/view_tests/views.py +++ b/tests/view_tests/views.py @@ -149,9 +149,9 @@ def non_sensitive_view(request): # so that the tests don't return false positives when the function's source # is displayed in the exception report. cooked_eggs = "".join(["s", "c", "r", "a", "m", "b", "l", "e", "d"]) # NOQA - sauce = "".join( + sauce = "".join( # NOQA ["w", "o", "r", "c", "e", "s", "t", "e", "r", "s", "h", "i", "r", "e"] - ) # NOQA + ) try: raise Exception except Exception: @@ -167,9 +167,9 @@ def sensitive_view(request): # so that the tests don't return false positives when the function's source # is displayed in the exception report. cooked_eggs = "".join(["s", "c", "r", "a", "m", "b", "l", "e", "d"]) # NOQA - sauce = "".join( + sauce = "".join( # NOQA ["w", "o", "r", "c", "e", "s", "t", "e", "r", "s", "h", "i", "r", "e"] - ) # NOQA + ) try: raise Exception except Exception: @@ -185,9 +185,9 @@ def paranoid_view(request): # so that the tests don't return false positives when the function's source # is displayed in the exception report. cooked_eggs = "".join(["s", "c", "r", "a", "m", "b", "l", "e", "d"]) # NOQA - sauce = "".join( + sauce = "".join( # NOQA ["w", "o", "r", "c", "e", "s", "t", "e", "r", "s", "h", "i", "r", "e"] - ) # NOQA + ) try: raise Exception except Exception: @@ -259,9 +259,9 @@ def custom_exception_reporter_filter_view(request): # so that the tests don't return false positives when the function's source # is displayed in the exception report. cooked_eggs = "".join(["s", "c", "r", "a", "m", "b", "l", "e", "d"]) # NOQA - sauce = "".join( + sauce = "".join( # NOQA ["w", "o", "r", "c", "e", "s", "t", "e", "r", "s", "h", "i", "r", "e"] - ) # NOQA + ) request.exception_reporter_filter = UnsafeExceptionReporterFilter() try: raise Exception @@ -299,9 +299,9 @@ class Klass: # so that the tests don't return false positives when the function's # source is displayed in the exception report. cooked_eggs = "".join(["s", "c", "r", "a", "m", "b", "l", "e", "d"]) # NOQA - sauce = "".join( + sauce = "".join( # NOQA ["w", "o", "r", "c", "e", "s", "t", "e", "r", "s", "h", "i", "r", "e"] - ) # NOQA + ) try: raise Exception except Exception: @@ -318,9 +318,9 @@ def sensitive_method_view(request): @sensitive_post_parameters("bacon-key", "sausage-key") def multivalue_dict_key_error(request): cooked_eggs = "".join(["s", "c", "r", "a", "m", "b", "l", "e", "d"]) # NOQA - sauce = "".join( + sauce = "".join( # NOQA ["w", "o", "r", "c", "e", "s", "t", "e", "r", "s", "h", "i", "r", "e"] - ) # NOQA + ) try: request.POST["bar"] except Exception: -- cgit v1.2.1