1+ import sys
12import unittest .case
23import unittest .result
34import unittest .suite
5+ from _typeshed import Incomplete
46from collections .abc import Callable , Iterable
57from typing import TextIO
68from typing_extensions import TypeAlias
@@ -14,23 +16,57 @@ class TextTestResult(unittest.result.TestResult):
1416 separator2 : str
1517 showAll : bool # undocumented
1618 stream : TextIO # undocumented
17- def __init__ (self , stream : TextIO , descriptions : bool , verbosity : int ) -> None : ...
19+ if sys .version_info >= (3 , 12 ):
20+ durations : unittest .result ._DurationsType | None
21+ def __init__ (
22+ self , stream : TextIO , descriptions : bool , verbosity : int , * , durations : unittest .result ._DurationsType | None = None
23+ ) -> None : ...
24+ else :
25+ def __init__ (self , stream : TextIO , descriptions : bool , verbosity : int ) -> None : ...
26+
1827 def getDescription (self , test : unittest .case .TestCase ) -> str : ...
1928 def printErrorList (self , flavour : str , errors : Iterable [tuple [unittest .case .TestCase , str ]]) -> None : ...
2029
2130class TextTestRunner :
2231 resultclass : _ResultClassType
23- def __init__ (
24- self ,
25- stream : TextIO | None = None ,
26- descriptions : bool = True ,
27- verbosity : int = 1 ,
28- failfast : bool = False ,
29- buffer : bool = False ,
30- resultclass : _ResultClassType | None = None ,
31- warnings : type [Warning ] | None = None ,
32- * ,
33- tb_locals : bool = False ,
34- ) -> None : ...
32+ # TODO: add `_WritelnDecorator` type
33+ # stream: _WritelnDecorator
34+ stream : Incomplete
35+ descriptions : bool
36+ verbosity : int
37+ failfast : bool
38+ buffer : bool
39+ warnings : str | None
40+ tb_locals : bool
41+
42+ if sys .version_info >= (3 , 12 ):
43+ durations : unittest .result ._DurationsType | None
44+ def __init__ (
45+ self ,
46+ stream : TextIO | None = None ,
47+ descriptions : bool = True ,
48+ verbosity : int = 1 ,
49+ failfast : bool = False ,
50+ buffer : bool = False ,
51+ resultclass : _ResultClassType | None = None ,
52+ warnings : str | None = None ,
53+ * ,
54+ tb_locals : bool = False ,
55+ durations : unittest .result ._DurationsType | None = None ,
56+ ) -> None : ...
57+ else :
58+ def __init__ (
59+ self ,
60+ stream : TextIO | None = None ,
61+ descriptions : bool = True ,
62+ verbosity : int = 1 ,
63+ failfast : bool = False ,
64+ buffer : bool = False ,
65+ resultclass : _ResultClassType | None = None ,
66+ warnings : str | None = None ,
67+ * ,
68+ tb_locals : bool = False ,
69+ ) -> None : ...
70+
3571 def _makeResult (self ) -> unittest .result .TestResult : ...
3672 def run (self , test : unittest .suite .TestSuite | unittest .case .TestCase ) -> unittest .result .TestResult : ...
0 commit comments