mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06: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:
@@ -50,10 +50,10 @@ class ExtraAssertMixin:
|
||||
|
||||
:param method: The assertion method to test.
|
||||
:param method_args: Positional arguments to pass to the method.
|
||||
:param expected_msg: The expected base error message (required keyword-only).
|
||||
:param msg_prefix: Optional prefix to be added to the message in the second
|
||||
subTest.
|
||||
:param method_kwargs: Keyword arguments to pass to the method.
|
||||
:param expected_msg: The expected base error message (required
|
||||
keyword-only). :param msg_prefix: Optional prefix to be added to the
|
||||
message in the second subTest. :param method_kwargs: Keyword arguments
|
||||
to pass to the method.
|
||||
|
||||
Used internally for testing Django's assertions.
|
||||
"""
|
||||
@@ -236,7 +236,10 @@ class AssertContainsTests(ExtraAssertMixin, SimpleTestCase):
|
||||
self.assertContains(r, b"\xe5\xb3\xa0".decode())
|
||||
|
||||
def test_unicode_not_contains(self):
|
||||
"Unicode characters can be searched for, and not found in template context"
|
||||
"""
|
||||
Unicode characters can be searched for, and not found in template
|
||||
context
|
||||
"""
|
||||
# Regression test for #10183
|
||||
r = self.client.get("/check_unicode/")
|
||||
self.assertNotContains(r, "はたけ")
|
||||
@@ -280,7 +283,8 @@ class AssertContainsTests(ExtraAssertMixin, SimpleTestCase):
|
||||
|
||||
def test_assert_not_contains_renders_template_response(self):
|
||||
"""
|
||||
An unrendered SimpleTemplateResponse may be used in assertNotContains().
|
||||
An unrendered SimpleTemplateResponse may be used in
|
||||
assertNotContains().
|
||||
"""
|
||||
template = engines["django"].from_string("Hello")
|
||||
response = SimpleTemplateResponse(template)
|
||||
@@ -378,7 +382,9 @@ class AssertTemplateUsedTests(TestDataMixin, TestCase):
|
||||
self.assertTemplateUsed(response, "base.html", count=2)
|
||||
|
||||
def test_template_rendered_multiple_times(self):
|
||||
"""Template assertions work when a template is rendered multiple times."""
|
||||
"""
|
||||
Template assertions work when a template is rendered multiple times.
|
||||
"""
|
||||
response = self.client.get("/render_template_multiple_times/")
|
||||
|
||||
self.assertTemplateUsed(response, "base.html", count=2)
|
||||
@@ -387,7 +393,10 @@ class AssertTemplateUsedTests(TestDataMixin, TestCase):
|
||||
@override_settings(ROOT_URLCONF="test_client_regress.urls")
|
||||
class AssertRedirectsTests(ExtraAssertMixin, SimpleTestCase):
|
||||
def test_redirect_page(self):
|
||||
"An assertion is raised if the original page couldn't be retrieved as expected"
|
||||
"""
|
||||
An assertion is raised if the original page couldn't be retrieved as
|
||||
expected
|
||||
"""
|
||||
# This page will redirect with code 301, not 302
|
||||
response = self.client.get("/permanent_redirect_view/")
|
||||
try:
|
||||
@@ -554,7 +563,8 @@ class AssertRedirectsTests(ExtraAssertMixin, SimpleTestCase):
|
||||
with self.assertRaises(RedirectCycleError) as context:
|
||||
self.client.get("/circular_redirect_1/", {}, follow=True)
|
||||
response = context.exception.last_response
|
||||
# The chain of redirects will get back to the starting point, but stop there.
|
||||
# The chain of redirects will get back to the starting point, but stop
|
||||
# there.
|
||||
self.assertRedirects(
|
||||
response, "/circular_redirect_2/", status_code=302, target_status_code=302
|
||||
)
|
||||
@@ -640,7 +650,10 @@ class AssertRedirectsTests(ExtraAssertMixin, SimpleTestCase):
|
||||
)
|
||||
|
||||
def test_redirect_on_non_redirect_page(self):
|
||||
"An assertion is raised if the original page couldn't be retrieved as expected"
|
||||
"""
|
||||
An assertion is raised if the original page couldn't be retrieved as
|
||||
expected
|
||||
"""
|
||||
# This page will redirect with code 301, not 302
|
||||
response = self.client.get("/get_view/")
|
||||
try:
|
||||
@@ -800,7 +813,8 @@ class ExceptionTests(TestDataMixin, TestCase):
|
||||
|
||||
# At this point, an exception has been raised, and should be cleared.
|
||||
|
||||
# This next operation should be successful; if it isn't we have a problem.
|
||||
# This next operation should be successful; if it isn't we have a
|
||||
# problem.
|
||||
login = self.client.login(username="staff", password="password")
|
||||
self.assertTrue(login, "Could not log in")
|
||||
self.client.get("/staff_only/")
|
||||
@@ -822,9 +836,10 @@ class TemplateExceptionTests(SimpleTestCase):
|
||||
self.client.get("/no_such_view/")
|
||||
|
||||
|
||||
# We need two different tests to check URLconf substitution - one to check
|
||||
# it was changed, and another one (without self.urls) to check it was reverted on
|
||||
# teardown. This pair of tests relies upon the alphabetical ordering of test execution.
|
||||
# We need two different tests to check URLconf substitution - one to check it
|
||||
# was changed, and another one (without self.urls) to check it was reverted on
|
||||
# teardown. This pair of tests relies upon the alphabetical ordering of test
|
||||
# execution.
|
||||
@override_settings(ROOT_URLCONF="test_client_regress.urls")
|
||||
class UrlconfSubstitutionTests(SimpleTestCase):
|
||||
def test_urlconf_was_changed(self):
|
||||
@@ -837,7 +852,8 @@ class UrlconfSubstitutionTests(SimpleTestCase):
|
||||
# name is to ensure alphabetical ordering.
|
||||
class zzUrlconfSubstitutionTests(SimpleTestCase):
|
||||
def test_urlconf_was_reverted(self):
|
||||
"""URLconf is reverted to original value after modification in a TestCase
|
||||
"""URLconf is reverted to original value after modification in a
|
||||
TestCase
|
||||
|
||||
This will not find a match as the default ROOT_URLCONF is empty.
|
||||
"""
|
||||
@@ -984,7 +1000,9 @@ class SessionTests(TestDataMixin, TestCase):
|
||||
|
||||
@override_settings(AUTH_USER_MODEL="test_client_regress.CustomUser")
|
||||
def test_logout_with_custom_user(self):
|
||||
"""Logout should send user_logged_out signal if custom user was logged in."""
|
||||
"""
|
||||
Logout should send user_logged_out signal if custom user was logged in.
|
||||
"""
|
||||
|
||||
def listener(*args, **kwargs):
|
||||
self.assertEqual(kwargs["sender"], CustomUser)
|
||||
@@ -1151,7 +1169,9 @@ class RequestMethodStringDataTests(SimpleTestCase):
|
||||
self.assertEqual(response.content, b"request method: PATCH")
|
||||
|
||||
def test_empty_string_data(self):
|
||||
"Request a view with empty string data via request method GET/POST/HEAD"
|
||||
"""
|
||||
Request a view with empty string data via request method GET/POST/HEAD
|
||||
"""
|
||||
# Regression test for #21740
|
||||
response = self.client.get("/body/", data="", content_type="application/json")
|
||||
self.assertEqual(response.content, b"")
|
||||
|
||||
Reference in New Issue
Block a user