From 3b24a3fa337bedc11352a17952cb9c3f77f9b9f2 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Wed, 21 Dec 2022 11:41:29 +0100 Subject: [PATCH] Removed unnecessary commas in tests. --- tests/aggregation/test_filter_argument.py | 2 +- tests/aggregation/tests.py | 2 +- tests/lookup/tests.py | 2 +- tests/prefetch_related/tests.py | 4 ++-- tests/queries/tests.py | 4 +--- tests/select_for_update/tests.py | 4 ++-- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/aggregation/test_filter_argument.py b/tests/aggregation/test_filter_argument.py index 3ef0401d4d..75835edb0b 100644 --- a/tests/aggregation/test_filter_argument.py +++ b/tests/aggregation/test_filter_argument.py @@ -139,7 +139,7 @@ class FilteredAggregateTests(TestCase): self.assertEqual(qs.get(pk__in=qs.values("pk")), self.a1) 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)), ) self.assertEqual(aggs["cnt"], 2) diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index 4e860a7aa3..67a57c162c 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -2088,7 +2088,7 @@ class AggregateTestCase(TestCase): def test_aggregation_over_annotation_shared_alias(self): self.assertEqual( - Publisher.objects.annotate(agg=Count("book__authors"),).aggregate( + Publisher.objects.annotate(agg=Count("book__authors")).aggregate( agg=Count("agg"), ), {"agg": 5}, diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py index 10e4c3d1fe..53eb76d174 100644 --- a/tests/lookup/tests.py +++ b/tests/lookup/tests.py @@ -1218,7 +1218,7 @@ class LookupTests(TestCase): def test_exact_exists(self): 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), ) self.assertCountEqual(seasons, Season.objects.all()) diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py index 4faf13bcaf..c153c0d9ec 100644 --- a/tests/prefetch_related/tests.py +++ b/tests/prefetch_related/tests.py @@ -1731,7 +1731,7 @@ class DirectPrefetchedObjectCacheReuseTests(TestCase): lookup. """ 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( "first_time_authors", Author.objects.prefetch_related( @@ -1785,7 +1785,7 @@ class DirectPrefetchedObjectCacheReuseTests(TestCase): def test_detect_is_fetched_with_to_attr(self): 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( "first_time_authors", Author.objects.prefetch_related( diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 332a6e5d9a..a6a2b252eb 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -3322,9 +3322,7 @@ class ExcludeTests(TestCase): ) self.assertCountEqual( Job.objects.annotate( - responsibility=subquery.filter(job=OuterRef("name"),).values( - "id" - )[:1] + responsibility=subquery.filter(job=OuterRef("name")).values("id")[:1] ), [self.j1, self.j2], ) diff --git a/tests/select_for_update/tests.py b/tests/select_for_update/tests.py index 5f5ada8939..97c067d76e 100644 --- a/tests/select_for_update/tests.py +++ b/tests/select_for_update/tests.py @@ -243,7 +243,7 @@ class SelectForUpdateTests(TransactionTestCase): def test_for_update_sql_model_proxy_generated_of(self): with transaction.atomic(), CaptureQueriesContext(connection) as ctx: list( - CityCountryProxy.objects.select_related("country",).select_for_update( + CityCountryProxy.objects.select_related("country").select_for_update( of=("country",), ) ) @@ -422,7 +422,7 @@ class SelectForUpdateTests(TransactionTestCase): with self.subTest(name=name): with self.assertRaisesMessage(FieldError, msg % name): with transaction.atomic(): - Person.objects.select_related("born", "profile",).exclude( + Person.objects.select_related("born", "profile").exclude( profile=None ).select_for_update(of=(name,)).get()