Skip to content

Commit a59861f

Browse files
authored
Fix type hints for SimpleTestCase (#2289)
- Remove deprecated attribute `allow_database_queries` - Fix incorrect argument type hints for `assertTemplateNotUsed`
1 parent 6ffe1ce commit a59861f

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

django-stubs/test/testcases.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class SimpleTestCase(unittest.TestCase):
6161
client: Client
6262
async_client_class: type[AsyncClient]
6363
async_client: AsyncClient
64-
allow_database_queries: bool
6564
# TODO: str -> Literal['__all__']
6665
databases: set[str] | str
6766
def __call__(self, result: unittest.TestResult | None = ...) -> None: ...
@@ -131,7 +130,7 @@ class SimpleTestCase(unittest.TestCase):
131130
count: int | None = ...,
132131
) -> _AssertTemplateUsedContext | None: ...
133132
def assertTemplateNotUsed(
134-
self, response: HttpResponseBase | str = ..., template_name: str | None = ..., msg_prefix: str = ...
133+
self, response: HttpResponseBase | str | None = ..., template_name: str | None = ..., msg_prefix: str = ...
135134
) -> _AssertTemplateNotUsedContext | None: ...
136135
def assertRaisesMessage(
137136
self, expected_exception: type[Exception], expected_message: str, *args: Any, **kwargs: Any

scripts/stubtest/allowlist_todo.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,6 @@ django.template.utils.EngineHandler.__init__
13081308
django.templatetags.i18n.BlockTranslateNode.__init__
13091309
django.templatetags.static.PrefixNode.__init__
13101310
django.templatetags.static.StaticNode.__init__
1311-
django.test.SimpleTestCase.assertTemplateNotUsed
13121311
django.test.runner.DiscoverRunner.log
13131312
django.test.runner.DiscoverRunner.reorder_by
13141313
django.test.runner.DummyList
@@ -1347,7 +1346,6 @@ django.test.selenium.SeleniumTestCaseBase.selenium_hub
13471346
django.test.testcases.LiveServerThread.__init__
13481347
django.test.testcases.LiveServerThread.server_class
13491348
django.test.testcases.SerializeMixin.tearDownClass
1350-
django.test.testcases.SimpleTestCase.assertTemplateNotUsed
13511349
django.test.testcases._AssertTemplateUsedContext.__init__
13521350
django.test.testcases._AssertTemplateUsedContext.message
13531351
django.urls.ResolverMatch.__iter__

0 commit comments

Comments
 (0)