mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-21 03:11:16 +08:00
Improve the unittest stubs. (#1927)
* Improvements to stdlib/2/unittest.pyi * Adds a bunch of missing things. * Fixes the signatures of assertRaises and failUnlessRaises. * Corrects the name of a TestCase subclass from CallableTestCase to FunctionTestCase. * Makes defaultTestLoader an instance of TestLoader, as it should be, rather than an alias. Based on https://docs.python.org/2/library/unittest.html and https://github.com/python/cpython/tree/2.7/Lib/unittest. * Improvements to stdlib/3/unittest/__init__.pyi * The constructor arguments to TextTestResult are all required. * There is a module-level load_tests() function. * removeResult() returns a bool. Based on https://docs.python.org/3/library/unittest.html and https://github.com/python/cpython/tree/master/Lib/unittest.
This commit is contained in:
@@ -279,8 +279,8 @@ class TestResult:
|
||||
outcome: Optional[_SysExcInfoType]) -> None: ...
|
||||
|
||||
class TextTestResult(TestResult):
|
||||
def __init__(self, stream: TextIO = ..., descriptions: bool = ...,
|
||||
verbosity: int = ...) -> None: ...
|
||||
def __init__(self, stream: TextIO, descriptions: bool,
|
||||
verbosity: int) -> None: ...
|
||||
_TextTestResult = TextTestResult
|
||||
|
||||
defaultTestLoader = ... # type: TestLoader
|
||||
@@ -324,10 +324,12 @@ def main(module: str = ..., defaultTest: _DefaultTestType = ...,
|
||||
buffer: Optional[bool] = ...,
|
||||
warnings: Optional[str] = ...) -> TestProgram: ...
|
||||
|
||||
def load_tests(loader: TestLoader, tests: TestSuite,
|
||||
pattern: Optional[str]) -> TestSuite: ...
|
||||
|
||||
def installHandler() -> None: ...
|
||||
def registerResult(result: TestResult) -> None: ...
|
||||
def removeResult(result: TestResult) -> None: ...
|
||||
def removeResult(result: TestResult) -> bool: ...
|
||||
@overload
|
||||
def removeHandler() -> None: ...
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user