Skip to content

Commit ab46a26

Browse files
authored
Annotate unittest.TestCase.__init_subclass__ (#13602)
1 parent 846d167 commit ab46a26

File tree

5 files changed

+5
-9
lines changed

5 files changed

+5
-9
lines changed

stdlib/@tests/stubtest_allowlists/py310.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ builtins.property.__set_name__ # Doesn't actually exist
164164
collections\.UserList\.index # ignoring pos-or-keyword parameter
165165
dataclasses.KW_ONLY # white lies around defaults
166166
importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect
167-
unittest.TestCase.__init_subclass__ # Runtime has *args, **kwargs, but will error if any are supplied
168-
unittest.case.TestCase.__init_subclass__ # Runtime has *args, **kwargs, but will error if any are supplied
169167

170168

171169
# ===============================================================

stdlib/@tests/stubtest_allowlists/py311.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ builtins.property.__set_name__ # Doesn't actually exist
145145
collections\.UserList\.index # ignoring pos-or-keyword parameter
146146
dataclasses.KW_ONLY # white lies around defaults
147147
importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect
148-
unittest.TestCase.__init_subclass__ # Runtime has *args, **kwargs, but will error if any are supplied
149-
unittest.case.TestCase.__init_subclass__ # Runtime has *args, **kwargs, but will error if any are supplied
150148

151149

152150
# ===============================================================

stdlib/@tests/stubtest_allowlists/py312.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ builtins.property.__set_name__ # Doesn't actually exist
157157
collections\.UserList\.index # ignoring pos-or-keyword parameter
158158
dataclasses.KW_ONLY # white lies around defaults
159159
importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect
160-
unittest.TestCase.__init_subclass__ # Runtime has *args, **kwargs, but will error if any are supplied
161-
unittest.case.TestCase.__init_subclass__ # Runtime has *args, **kwargs, but will error if any are supplied
162160

163161

164162
# ===============================================================

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,3 @@ builtins.property.__set_name__ # Doesn't actually exist
147147
collections\.UserList\.index # ignoring pos-or-keyword parameter
148148
dataclasses.KW_ONLY # white lies around defaults
149149
importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect
150-
unittest.TestCase.__init_subclass__ # Runtime has *args, **kwargs, but will error if any are supplied
151-
unittest.case.TestCase.__init_subclass__ # Runtime has *args, **kwargs, but will error if any are supplied

stdlib/unittest/case.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ from typing import (
2020
TypeVar,
2121
overload,
2222
)
23-
from typing_extensions import ParamSpec, Self, TypeAlias
23+
from typing_extensions import Never, ParamSpec, Self, TypeAlias
2424
from warnings import WarningMessage
2525

2626
if sys.version_info >= (3, 9):
@@ -323,6 +323,10 @@ class TestCase:
323323
self, subset: Mapping[Any, Any], dictionary: Mapping[Any, Any], msg: object = None
324324
) -> None: ...
325325

326+
if sys.version_info >= (3, 10):
327+
# Runtime has *args, **kwargs, but will error if any are supplied
328+
def __init_subclass__(cls, *args: Never, **kwargs: Never) -> None: ...
329+
326330
class FunctionTestCase(TestCase):
327331
def __init__(
328332
self,

0 commit comments

Comments
 (0)