From df9e5afa4cc0744c8ac12495b353cc42c0aeadad Mon Sep 17 00:00:00 2001 From: Petter Friberg Date: Tue, 7 Nov 2023 09:37:28 +0100 Subject: [PATCH] Fix types for `assertNumQueries` and `assertQuerySetEqual` --- django-stubs/test/testcases.pyi | 4 ++-- scripts/stubtest/allowlist_todo.txt | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/django-stubs/test/testcases.pyi b/django-stubs/test/testcases.pyi index 3b0466f17..0a1cc8e73 100644 --- a/django-stubs/test/testcases.pyi +++ b/django-stubs/test/testcases.pyi @@ -218,12 +218,12 @@ class TransactionTestCase(SimpleTestCase): self, qs: Iterator[Any] | list[Model] | QuerySet | RawQuerySet, values: Collection[Any], - transform: Callable[[Model], Any] | type[str] = ..., + transform: Callable[[Model], Any] | type[str] | None = ..., ordered: bool = ..., msg: str | None = ..., ) -> None: ... @overload - def assertNumQueries(self, num: int, using: str = ...) -> _AssertNumQueriesContext: ... # type: ignore[misc] + def assertNumQueries(self, num: int, func: None = ..., *, using: str = ...) -> _AssertNumQueriesContext: ... @overload def assertNumQueries( self, num: int, func: Callable[..., Any], *args: Any, using: str = ..., **kwargs: Any diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index de9838856..79e4d3d8e 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -1953,8 +1953,6 @@ django.templatetags.tz.timezone_constructor django.test.SimpleTestCase.assertFormError django.test.SimpleTestCase.assertFormSetError django.test.SimpleTestCase.assertTemplateNotUsed -django.test.TransactionTestCase.assertNumQueries -django.test.TransactionTestCase.assertQuerySetEqual django.test.runner.DiscoverRunner.build_suite django.test.runner.DiscoverRunner.log django.test.runner.DiscoverRunner.reorder_by @@ -1997,8 +1995,6 @@ django.test.testcases.SerializeMixin.tearDownClass django.test.testcases.SimpleTestCase.assertFormError django.test.testcases.SimpleTestCase.assertFormSetError django.test.testcases.SimpleTestCase.assertTemplateNotUsed -django.test.testcases.TransactionTestCase.assertNumQueries -django.test.testcases.TransactionTestCase.assertQuerySetEqual django.test.testcases._AssertTemplateUsedContext.__init__ django.test.testcases._AssertTemplateUsedContext.message django.test.utils.TimeKeeperProtocol