@@ -6,21 +6,22 @@ from _typeshed import SupportsFlush, SupportsWrite
66from collections .abc import Callable , Iterable
77from typing import Any , Generic , Protocol , TypeVar
88from typing_extensions import Never , TypeAlias
9+ from warnings import _ActionKind
910
10- _ResultClassType : TypeAlias = Callable [[_TextTestStream , bool , int ], TextTestResult ]
11+ _ResultClassType : TypeAlias = Callable [[_TextTestStream , bool , int ], TextTestResult [ Any ] ]
1112
1213class _SupportsWriteAndFlush (SupportsWrite [str ], SupportsFlush , Protocol ): ...
1314
1415# All methods used by unittest.runner.TextTestResult's stream
1516class _TextTestStream (_SupportsWriteAndFlush , Protocol ):
16- def writeln (self , arg : str | None = None , / ) -> str : ...
17+ def writeln (self , arg : str | None = None , / ) -> None : ...
1718
1819# _WritelnDecorator should have all the same attrs as its stream param.
1920# But that's not feasible to do Generically
2021# We can expand the attributes if requested
2122class _WritelnDecorator :
22- def __init__ (self , stream : _TextTestStream ) -> None : ...
23- def writeln (self , arg : str | None = None ) -> str : ...
23+ def __init__ (self , stream : _SupportsWriteAndFlush ) -> None : ...
24+ def writeln (self , arg : str | None = None ) -> None : ...
2425 def __getattr__ (self , attr : str ) -> Any : ... # Any attribute from the stream type passed to __init__
2526 # These attributes are prevented by __getattr__
2627 stream : Never
@@ -39,10 +40,8 @@ class TextTestResult(unittest.result.TestResult, Generic[_StreamT]):
3940 showAll : bool # undocumented
4041 stream : _StreamT # undocumented
4142 if sys .version_info >= (3 , 12 ):
42- durations : unittest .result ._DurationsType | None
43- def __init__ (
44- self , stream : _StreamT , descriptions : bool , verbosity : int , * , durations : unittest .result ._DurationsType | None = None
45- ) -> None : ...
43+ durations : int | None
44+ def __init__ (self , stream : _StreamT , descriptions : bool , verbosity : int , * , durations : int | None = None ) -> None : ...
4645 else :
4746 def __init__ (self , stream : _StreamT , descriptions : bool , verbosity : int ) -> None : ...
4847
@@ -56,11 +55,11 @@ class TextTestRunner:
5655 verbosity : int
5756 failfast : bool
5857 buffer : bool
59- warnings : str | None
58+ warnings : _ActionKind | None
6059 tb_locals : bool
6160
6261 if sys .version_info >= (3 , 12 ):
63- durations : unittest . result . _DurationsType | None
62+ durations : int | None
6463 def __init__ (
6564 self ,
6665 stream : _SupportsWriteAndFlush | None = None ,
@@ -69,10 +68,10 @@ class TextTestRunner:
6968 failfast : bool = False ,
7069 buffer : bool = False ,
7170 resultclass : _ResultClassType | None = None ,
72- warnings : str | None = None ,
71+ warnings : _ActionKind | None = None ,
7372 * ,
7473 tb_locals : bool = False ,
75- durations : unittest . result . _DurationsType | None = None ,
74+ durations : int | None = None ,
7675 ) -> None : ...
7776 else :
7877 def __init__ (
0 commit comments