1
0
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:
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

@@ -486,9 +486,10 @@ class CustomPrefetchTests(TestCase):
@classmethod
def traverse_qs(cls, obj_iter, path):
"""
Helper method that returns a list containing a list of the objects in the
obj_iter. Then for each object in the obj_iter, the path will be
recursively travelled and the found objects are added to the return value.
Helper method that returns a list containing a list of the objects in
the obj_iter. Then for each object in the obj_iter, the path will be
recursively travelled and the found objects are added to the return
value.
"""
ret_val = []
@@ -1064,7 +1065,8 @@ class CustomPrefetchTests(TestCase):
Prefetch("houses", House.objects.values("pk"))
with self.assertRaisesMessage(ValueError, msg):
Prefetch("houses", House.objects.values_list("pk"))
# That error doesn't affect managers with custom ModelIterable subclasses
# That error doesn't affect managers with custom ModelIterable
# subclasses
self.assertIs(
Teacher.objects_custom.all()._iterable_class, ModelIterableSubclass
)
@@ -1134,8 +1136,8 @@ class DefaultManagerTests(TestCase):
def test_m2m_then_m2m(self):
with self.assertNumQueries(3):
# When we prefetch the teachers, and force the query, we don't want
# the default manager on teachers to immediately get all the related
# qualifications, since this will do one query per teacher.
# the default manager on teachers to immediately get all the
# related qualifications, since this will do one query per teacher.
qs = Department.objects.prefetch_related("teachers")
depts = "".join(
"%s department: %s\n"
@@ -1396,9 +1398,9 @@ class MultiTableInheritanceTest(TestCase):
for a in Author.objects.prefetch_related("authorwithage")
]
# Regression for #18090: the prefetching query must include an IN clause.
# Note that on Oracle the table name is upper case in the generated SQL,
# thus the .lower() call.
# Regression for #18090: the prefetching query must include an IN
# clause. Note that on Oracle the table name is upper case in the
# generated SQL, thus the .lower() call.
self.assertIn("authorwithage", connection.queries[-1]["sql"].lower())
self.assertIn(" IN ", connection.queries[-1]["sql"])
@@ -1492,8 +1494,9 @@ class LookupOrderingTest(TestCase):
def test_order(self):
with self.assertNumQueries(4):
# The following two queries must be done in the same order as written,
# otherwise 'primary_house' will cause non-prefetched lookups
# The following two queries must be done in the same order as
# written, otherwise 'primary_house' will cause non-prefetched
# lookups
qs = Person.objects.prefetch_related(
"houses__rooms", "primary_house__occupants"
)
@@ -1509,7 +1512,8 @@ class NullableTest(TestCase):
def test_traverse_nullable(self):
# Because we use select_related() for 'boss', it doesn't need to be
# prefetched, but we can still traverse it although it contains some nulls
# prefetched, but we can still traverse it although it contains some
# nulls
with self.assertNumQueries(2):
qs = Employee.objects.select_related("boss").prefetch_related("boss__serfs")
co_serfs = [
@@ -1816,8 +1820,8 @@ class DirectPrefetchedObjectCacheReuseTests(TestCase):
def test_detect_is_fetched(self):
"""
Nested prefetch_related() shouldn't trigger duplicate queries for the same
lookup.
Nested prefetch_related() shouldn't trigger duplicate queries for the
same lookup.
"""
with self.assertNumQueries(3):
books = Book.objects.filter(title__in=["book1", "book2"]).prefetch_related(