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

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.
This commit is contained in:
django-bot
2025-07-22 20:41:41 -07:00
committed by nessita
parent 55b0cc2131
commit 69a93a88ed
378 changed files with 2781 additions and 1861 deletions

View File

@@ -191,7 +191,10 @@ class AdminScriptTestCase(SimpleTestCase):
)
def assertNotInOutput(self, stream, msg):
"Utility assertion: assert that the given message doesn't exist in the output"
"""
Utility assertion: assert that the given message doesn't exist in the
output
"""
self.assertNotIn(
msg, stream, "'%s' matches actual output text '%s'" % (msg, stream)
)
@@ -503,7 +506,10 @@ class DjangoAdminMinimalSettings(AdminScriptTestCase):
self.assertOutput(err, "No module named '?bad_settings'?", regex=True)
def test_custom_command(self):
"minimal: django-admin can't execute user commands unless settings are provided"
"""
minimal: django-admin can't execute user commands unless settings are
provided
"""
args = ["noargs_command"]
out, err = self.run_django_admin(args)
self.assertNoOutput(out)
@@ -745,7 +751,10 @@ class DjangoAdminSettingsDirectory(AdminScriptTestCase):
)
def test_setup_environ_custom_template(self):
"directory: startapp creates the correct directory with a custom template"
"""
directory: startapp creates the correct directory with a custom
template
"""
template_path = os.path.join(custom_templates_dir, "app_template")
args = ["startapp", "--template", template_path, "custom_settings_test"]
app_path = os.path.join(self.test_dir, "custom_settings_test")
@@ -1089,7 +1098,10 @@ class ManageMinimalSettings(AdminScriptTestCase):
self.assertOutput(err, "No installed app with label 'admin_scripts'.")
def test_builtin_with_settings(self):
"minimal: manage.py builtin commands fail if settings are provided as argument"
"""
minimal: manage.py builtin commands fail if settings are provided as
argument
"""
args = ["check", "--settings=test_project.settings", "admin_scripts"]
out, err = self.run_manage(args)
self.assertNoOutput(out)
@@ -1126,7 +1138,10 @@ class ManageMinimalSettings(AdminScriptTestCase):
self.assertOutput(err, "No module named '?bad_settings'?", regex=True)
def test_custom_command(self):
"minimal: manage.py can't execute user commands without appropriate settings"
"""
minimal: manage.py can't execute user commands without appropriate
settings
"""
args = ["noargs_command"]
out, err = self.run_manage(args)
self.assertNoOutput(out)
@@ -1175,7 +1190,10 @@ class ManageAlternateSettings(AdminScriptTestCase):
)
def test_builtin_with_settings(self):
"alternate: manage.py builtin commands work with settings provided as argument"
"""
alternate: manage.py builtin commands work with settings provided as
argument
"""
args = ["check", "--settings=alternate_settings", "admin_scripts"]
out, err = self.run_manage(args)
self.assertOutput(out, SYSTEM_CHECK_MSG)
@@ -1331,7 +1349,9 @@ class ManageMultipleSettings(AdminScriptTestCase):
self.assertOutput(err, "No module named '?bad_settings'?", regex=True)
def test_custom_command(self):
"multiple: manage.py can't execute user commands using default settings"
"""
multiple: manage.py can't execute user commands using default settings
"""
args = ["noargs_command"]
out, err = self.run_manage(args)
self.assertNoOutput(out)
@@ -1709,7 +1729,8 @@ class ManageRunserver(SimpleTestCase):
def test_readonly_database(self):
"""
runserver.check_migrations() doesn't choke when a database is read-only.
runserver.check_migrations() doesn't choke when a database is
read-only.
"""
with mock.patch.object(MigrationRecorder, "has_table", return_value=False):
self.cmd.check_migrations()
@@ -1754,7 +1775,9 @@ class ManageRunserver(SimpleTestCase):
self.addCleanup(setattr, registry, "registered_checks", original_checks)
class CustomRunserverCommand(RunserverCommand):
"""Rather than mock run(), raise immediately after system checks run."""
"""
Rather than mock run(), raise immediately after system checks run.
"""
def check_migrations(self, *args, **kwargs):
raise CustomException
@@ -1921,7 +1944,8 @@ class CommandTypes(AdminScriptTestCase):
def test_version_alternative(self):
"--version is equivalent to version"
args1, args2 = ["version"], ["--version"]
# It's possible one outputs on stderr and the other on stdout, hence the set
# It's possible one outputs on stderr and the other on stdout, hence
# the set
self.assertEqual(set(self.run_manage(args1)), set(self.run_manage(args2)))
def test_help(self):
@@ -2136,13 +2160,18 @@ class CommandTypes(AdminScriptTestCase):
self._test_base_command(args, expected_labels, option_a="'x'")
def test_base_command_with_options(self):
"User BaseCommands can execute with multiple options when a label is provided"
"""
User BaseCommands can execute with multiple options when a label is
provided
"""
args = ["base_command", "testlabel", "-a", "x", "--option_b=y"]
expected_labels = "('testlabel',)"
self._test_base_command(args, expected_labels, option_a="'x'", option_b="'y'")
def test_base_command_with_wrong_option(self):
"User BaseCommands outputs command usage when wrong option is specified"
"""
User BaseCommands outputs command usage when wrong option is specified
"""
args = ["base_command", "--invalid"]
out, err = self.run_manage(args)
self.assertNoOutput(out)
@@ -2164,8 +2193,8 @@ class CommandTypes(AdminScriptTestCase):
def test_base_run_from_argv(self):
"""
Test run_from_argv properly terminates even with custom execute() (#19665)
Also test proper traceback display.
Test run_from_argv properly terminates even with custom execute()
(#19665) Also test proper traceback display.
"""
err = StringIO()
command = BaseCommand(stderr=err)
@@ -2292,7 +2321,10 @@ class CommandTypes(AdminScriptTestCase):
self.assertOutput(err, "No installed app with label 'NOT_AN_APP'.")
def test_app_command_some_invalid_app_labels(self):
"User AppCommands can execute when some of the provided app names are invalid"
"""
User AppCommands can execute when some of the provided app names are
invalid
"""
args = ["app_command", "auth", "NOT_AN_APP"]
out, err = self.run_manage(args)
self.assertOutput(err, "No installed app with label 'NOT_AN_APP'.")
@@ -2316,7 +2348,10 @@ class CommandTypes(AdminScriptTestCase):
self.assertOutput(err, "Enter at least one label")
def test_label_command_multiple_label(self):
"User LabelCommands are executed multiple times if multiple labels are provided"
"""
User LabelCommands are executed multiple times if multiple labels are
provided
"""
args = ["label_command", "testlabel", "anotherlabel"]
out, err = self.run_manage(args)
self.assertNoOutput(err)
@@ -2558,7 +2593,9 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
)
def test_invalid_project_name(self):
"Make sure the startproject management command validates a project name"
"""
Make sure the startproject management command validates a project name
"""
for bad_name in ("7testproject", "../testproject"):
with self.subTest(project_name=bad_name):
args = ["startproject", bad_name]
@@ -2773,7 +2810,10 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
self.assertTrue(os.path.exists(os.path.join(testproject_dir, "run.py")))
def test_file_without_extension(self):
"Make sure the startproject management command is able to render custom files"
"""
Make sure the startproject management command is able to render custom
files
"""
template_path = os.path.join(custom_templates_dir, "project_template")
args = [
"startproject",
@@ -2845,7 +2885,8 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
def test_custom_project_destination_missing(self):
"""
Create the directory when the provided destination directory doesn't exist.
Create the directory when the provided destination directory doesn't
exist.
"""
template_path = os.path.join(custom_templates_dir, "project_template")
args = [