Removed unnecessary commas in tests.

This commit is contained in:
Mariusz Felisiak 2022-12-21 11:41:29 +01:00 committed by GitHub
parent 2d676ee119
commit 3b24a3fa33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 10 deletions

View File

@ -139,7 +139,7 @@ class FilteredAggregateTests(TestCase):
self.assertEqual(qs.get(pk__in=qs.values("pk")), self.a1) self.assertEqual(qs.get(pk__in=qs.values("pk")), self.a1)
def test_filtered_aggregate_ref_annotation(self): def test_filtered_aggregate_ref_annotation(self):
aggs = Author.objects.annotate(double_age=F("age") * 2,).aggregate( aggs = Author.objects.annotate(double_age=F("age") * 2).aggregate(
cnt=Count("pk", filter=Q(double_age__gt=100)), cnt=Count("pk", filter=Q(double_age__gt=100)),
) )
self.assertEqual(aggs["cnt"], 2) self.assertEqual(aggs["cnt"], 2)

View File

@ -2088,7 +2088,7 @@ class AggregateTestCase(TestCase):
def test_aggregation_over_annotation_shared_alias(self): def test_aggregation_over_annotation_shared_alias(self):
self.assertEqual( self.assertEqual(
Publisher.objects.annotate(agg=Count("book__authors"),).aggregate( Publisher.objects.annotate(agg=Count("book__authors")).aggregate(
agg=Count("agg"), agg=Count("agg"),
), ),
{"agg": 5}, {"agg": 5},

View File

@ -1218,7 +1218,7 @@ class LookupTests(TestCase):
def test_exact_exists(self): def test_exact_exists(self):
qs = Article.objects.filter(pk=OuterRef("pk")) qs = Article.objects.filter(pk=OuterRef("pk"))
seasons = Season.objects.annotate(pk_exists=Exists(qs),).filter( seasons = Season.objects.annotate(pk_exists=Exists(qs)).filter(
pk_exists=Exists(qs), pk_exists=Exists(qs),
) )
self.assertCountEqual(seasons, Season.objects.all()) self.assertCountEqual(seasons, Season.objects.all())

View File

@ -1731,7 +1731,7 @@ class DirectPrefetchedObjectCacheReuseTests(TestCase):
lookup. lookup.
""" """
with self.assertNumQueries(3): with self.assertNumQueries(3):
books = Book.objects.filter(title__in=["book1", "book2"],).prefetch_related( books = Book.objects.filter(title__in=["book1", "book2"]).prefetch_related(
Prefetch( Prefetch(
"first_time_authors", "first_time_authors",
Author.objects.prefetch_related( Author.objects.prefetch_related(
@ -1785,7 +1785,7 @@ class DirectPrefetchedObjectCacheReuseTests(TestCase):
def test_detect_is_fetched_with_to_attr(self): def test_detect_is_fetched_with_to_attr(self):
with self.assertNumQueries(3): with self.assertNumQueries(3):
books = Book.objects.filter(title__in=["book1", "book2"],).prefetch_related( books = Book.objects.filter(title__in=["book1", "book2"]).prefetch_related(
Prefetch( Prefetch(
"first_time_authors", "first_time_authors",
Author.objects.prefetch_related( Author.objects.prefetch_related(

View File

@ -3322,9 +3322,7 @@ class ExcludeTests(TestCase):
) )
self.assertCountEqual( self.assertCountEqual(
Job.objects.annotate( Job.objects.annotate(
responsibility=subquery.filter(job=OuterRef("name"),).values( responsibility=subquery.filter(job=OuterRef("name")).values("id")[:1]
"id"
)[:1]
), ),
[self.j1, self.j2], [self.j1, self.j2],
) )

View File

@ -243,7 +243,7 @@ class SelectForUpdateTests(TransactionTestCase):
def test_for_update_sql_model_proxy_generated_of(self): def test_for_update_sql_model_proxy_generated_of(self):
with transaction.atomic(), CaptureQueriesContext(connection) as ctx: with transaction.atomic(), CaptureQueriesContext(connection) as ctx:
list( list(
CityCountryProxy.objects.select_related("country",).select_for_update( CityCountryProxy.objects.select_related("country").select_for_update(
of=("country",), of=("country",),
) )
) )
@ -422,7 +422,7 @@ class SelectForUpdateTests(TransactionTestCase):
with self.subTest(name=name): with self.subTest(name=name):
with self.assertRaisesMessage(FieldError, msg % name): with self.assertRaisesMessage(FieldError, msg % name):
with transaction.atomic(): with transaction.atomic():
Person.objects.select_related("born", "profile",).exclude( Person.objects.select_related("born", "profile").exclude(
profile=None profile=None
).select_for_update(of=(name,)).get() ).select_for_update(of=(name,)).get()