diff options
| author | django-bot <ops@djangoproject.com> | 2025-07-22 20:41:41 -0700 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2025-07-23 20:17:55 -0300 |
| commit | 69a93a88edb56ba47f624dac7a21aacc47ea474f (patch) | |
| tree | f57507a4435d032493cae40e06ecb254790b67b2 /tests/view_tests | |
| parent | 55b0cc21310b76ce4018dd793ba50556eaf0af06 (diff) | |
Refs #36500 -- Rewrapped long docstrings and block comments via a script.
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
Diffstat (limited to 'tests/view_tests')
| -rw-r--r-- | tests/view_tests/tests/test_debug.py | 27 | ||||
| -rw-r--r-- | tests/view_tests/tests/test_i18n.py | 10 | ||||
| -rw-r--r-- | tests/view_tests/tests/test_static.py | 5 | ||||
| -rw-r--r-- | tests/view_tests/views.py | 11 |
4 files changed, 35 insertions, 18 deletions
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py index f5cb82cd2d..8e36ab7eb1 100644 --- a/tests/view_tests/tests/test_debug.py +++ b/tests/view_tests/tests/test_debug.py @@ -396,7 +396,8 @@ class DebugViewTests(SimpleTestCase): def test_no_template_source_loaders(self): """ - Make sure if you don't specify a template, the debug view doesn't blow up. + Make sure if you don't specify a template, the debug view doesn't blow + up. """ with self.assertLogs("django.request", "ERROR"): with self.assertRaises(TemplateDoesNotExist): @@ -493,7 +494,8 @@ class DebugViewQueriesAllowedTests(SimpleTestCase): def test_handle_db_exception(self): """ Ensure the debug view works when a database exception is raised by - performing an invalid query and passing the exception to the debug view. + performing an invalid query and passing the exception to the debug + view. """ with connection.cursor() as cursor: try: @@ -614,7 +616,9 @@ class ExceptionReporterTests(SimpleTestCase): ) def test_eol_support(self): - """The ExceptionReporter supports Unix, Windows and Macintosh EOL markers""" + """ + The ExceptionReporter supports Unix, Windows and Macintosh EOL markers + """ LINES = ["print %d" % i for i in range(1, 6)] reporter = ExceptionReporter(None, None, None, None) @@ -1040,7 +1044,10 @@ class ExceptionReporterTests(SimpleTestCase): self.assertIn("<p>Request data not supplied</p>", html) def test_non_utf8_values_handling(self): - "Non-UTF-8 exceptions/values should not make the output generation choke." + """ + Non-UTF-8 exceptions/values should not make the output generation + choke. + """ try: class NonUtf8Output(Exception): @@ -1446,7 +1453,8 @@ class ExceptionReportTestMixin: self, view, check_for_vars=True, check_for_POST_params=True ): """ - Asserts that no variables or POST parameters are displayed in the response. + Asserts that no variables or POST parameters are displayed in the + response. """ request = self.rf.post("/some_url/", self.breakfast_data) response = view(request) @@ -1465,7 +1473,8 @@ class ExceptionReportTestMixin: def verify_unsafe_email(self, view, check_for_POST_params=True): """ - Asserts that potentially sensitive info are displayed in the email report. + Asserts that potentially sensitive info are displayed in the email + report. """ with self.settings(ADMINS=["admin@example.com"]): mail.outbox = [] # Empty outbox @@ -1501,7 +1510,8 @@ class ExceptionReportTestMixin: def verify_safe_email(self, view, check_for_POST_params=True): """ - Asserts that certain sensitive info are not displayed in the email report. + Asserts that certain sensitive info are not displayed in the email + report. """ with self.settings(ADMINS=["admin@example.com"]): mail.outbox = [] # Empty outbox @@ -1544,7 +1554,8 @@ class ExceptionReportTestMixin: def verify_paranoid_email(self, view): """ - Asserts that no variables or POST parameters are displayed in the email report. + Asserts that no variables or POST parameters are displayed in the email + report. """ with self.settings(ADMINS=["admin@example.com"]): mail.outbox = [] # Empty outbox diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py index 229ce68bfc..f4ba5249a2 100644 --- a/tests/view_tests/tests/test_i18n.py +++ b/tests/view_tests/tests/test_i18n.py @@ -272,8 +272,9 @@ class I18NViewTests(SimpleTestCase): response.headers["Content-Type"], 'text/javascript; charset="utf-8"' ) # response content must include a line like: - # "this is to be translated": <value of trans_txt Python variable> - # json.dumps() is used to be able to check Unicode strings. + # "this is to be translated": <value of trans_txt Python + # variable> json.dumps() is used to be able to check Unicode + # strings. self.assertContains(response, json.dumps(trans_txt), 1) if lang_code == "fr": # Message with context (msgctxt) @@ -417,8 +418,9 @@ class I18NViewTests(SimpleTestCase): def test_non_english_default_english_userpref(self): """ Same as above with the difference that there IS an 'en' translation - available. The JavaScript i18n view must return a NON empty language catalog - with the proper English translations. See #13726 for more details. + available. The JavaScript i18n view must return a NON empty language + catalog with the proper English translations. See #13726 for more + details. """ with self.settings(LANGUAGE_CODE="fr"), override("en-us"): response = self.client.get("/jsi18n_english_translation/") diff --git a/tests/view_tests/tests/test_static.py b/tests/view_tests/tests/test_static.py index f60ca88cd2..ca1b5f1638 100644 --- a/tests/view_tests/tests/test_static.py +++ b/tests/view_tests/tests/test_static.py @@ -39,7 +39,10 @@ class StaticTests(SimpleTestCase): ) def test_chunked(self): - "The static view should stream files in chunks to avoid large memory usage" + """ + The static view should stream files in chunks to avoid large memory + usage + """ response = self.client.get("/%s/%s" % (self.prefix, "long-line.txt")) response_iterator = iter(response) first_chunk = next(response_iterator) diff --git a/tests/view_tests/views.py b/tests/view_tests/views.py index 9eb7a352d6..1986341177 100644 --- a/tests/view_tests/views.py +++ b/tests/view_tests/views.py @@ -125,10 +125,10 @@ def render_no_template(request): def send_log(request, exc_info): logger = logging.getLogger("django") - # The default logging config has a logging filter to ensure admin emails are - # only sent with DEBUG=False, but since someone might choose to remove that - # filter, we still want to be able to test the behavior of error emails - # with DEBUG=True. So we need to remove the filter temporarily. + # The default logging config has a logging filter to ensure admin emails + # are only sent with DEBUG=False, but since someone might choose to remove + # that filter, we still want to be able to test the behavior of error + # emails with DEBUG=True. So we need to remove the filter temporarily. admin_email_handler = [ h for h in logger.handlers if h.__class__.__name__ == "AdminEmailHandler" ][0] @@ -417,7 +417,8 @@ def json_response_view(request): { "a": [1, 2, 3], "foo": {"bar": "baz"}, - # Make sure datetime and Decimal objects would be serialized properly + # Make sure datetime and Decimal objects would be serialized + # properly "timestamp": datetime.datetime(2013, 5, 19, 20), "value": decimal.Decimal("3.14"), } |
