3 from typing import Any, Callable, NamedTuple, Tuple, Type
5 class TestResults(NamedTuple):
9 OPTIONFLAGS_BY_NAME: dict[str, int]
11 def register_optionflag(name: str) -> int: ...
13 DONT_ACCEPT_TRUE_FOR_1: int
14 DONT_ACCEPT_BLANKLINE: int
15 NORMALIZE_WHITESPACE: int
18 IGNORE_EXCEPTION_DETAIL: int
25 REPORT_ONLY_FIRST_FAILURE: int
39 options: dict[int, bool]
44 exc_msg: str | None = ...,
47 options: dict[int, bool] | None = ...,
49 def __hash__(self) -> int: ...
52 examples: list[Example]
60 examples: list[Example],
61 globs: dict[str, Any],
65 docstring: str | None,
67 def __hash__(self) -> int: ...
68 def __lt__(self, other: DocTest) -> bool: ...
71 def parse(self, string: str, name: str = ...) -> list[str | Example]: ...
72 def get_doctest(self, string: str, globs: dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ...
73 def get_examples(self, string: str, name: str = ...) -> list[Example]: ...
77 self, verbose: bool = ..., parser: DocTestParser = ..., recurse: bool = ..., exclude_empty: bool = ...
82 name: str | None = ...,
83 module: None | bool | types.ModuleType = ...,
84 globs: dict[str, Any] | None = ...,
85 extraglobs: dict[str, Any] | None = ...,
86 ) -> list[DocTest]: ...
88 _Out = Callable[[str], Any]
89 _ExcInfo = Tuple[Type[BaseException], BaseException, types.TracebackType]
94 original_optionflags: int
98 def __init__(self, checker: OutputChecker | None = ..., verbose: bool | None = ..., optionflags: int = ...) -> None: ...
99 def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ...
100 def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
101 def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
102 def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...
104 self, test: DocTest, compileflags: int | None = ..., out: _Out | None = ..., clear_globs: bool = ...
105 ) -> TestResults: ...
106 def summarize(self, verbose: bool | None = ...) -> TestResults: ...
107 def merge(self, other: DocTestRunner) -> None: ...
110 def check_output(self, want: str, got: str, optionflags: int) -> bool: ...
111 def output_difference(self, example: Example, got: str, optionflags: int) -> str: ...
113 class DocTestFailure(Exception):
117 def __init__(self, test: DocTest, example: Example, got: str) -> None: ...
119 class UnexpectedException(Exception):
123 def __init__(self, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...
125 class DebugRunner(DocTestRunner): ...
127 master: DocTestRunner | None
130 m: types.ModuleType | None = ...,
131 name: str | None = ...,
132 globs: dict[str, Any] | None = ...,
133 verbose: bool | None = ...,
135 optionflags: int = ...,
136 extraglobs: dict[str, Any] | None = ...,
137 raise_on_error: bool = ...,
138 exclude_empty: bool = ...,
139 ) -> TestResults: ...
142 module_relative: bool = ...,
143 name: str | None = ...,
144 package: None | str | types.ModuleType = ...,
145 globs: dict[str, Any] | None = ...,
146 verbose: bool | None = ...,
148 optionflags: int = ...,
149 extraglobs: dict[str, Any] | None = ...,
150 raise_on_error: bool = ...,
151 parser: DocTestParser = ...,
152 encoding: str | None = ...,
153 ) -> TestResults: ...
154 def run_docstring_examples(
155 f: object, globs: dict[str, Any], verbose: bool = ..., name: str = ..., compileflags: int | None = ..., optionflags: int = ...
157 def set_unittest_reportflags(flags: int) -> int: ...
159 class DocTestCase(unittest.TestCase):
163 optionflags: int = ...,
164 setUp: Callable[[DocTest], Any] | None = ...,
165 tearDown: Callable[[DocTest], Any] | None = ...,
166 checker: OutputChecker | None = ...,
168 def setUp(self) -> None: ...
169 def tearDown(self) -> None: ...
170 def runTest(self) -> None: ...
171 def format_failure(self, err: str) -> str: ...
172 def debug(self) -> None: ...
173 def id(self) -> str: ...
174 def __hash__(self) -> int: ...
175 def shortDescription(self) -> str: ...
177 class SkipDocTestCase(DocTestCase):
178 def __init__(self, module: types.ModuleType) -> None: ...
179 def setUp(self) -> None: ...
180 def test_skip(self) -> None: ...
181 def shortDescription(self) -> str: ...
183 class _DocTestSuite(unittest.TestSuite): ...
186 module: None | str | types.ModuleType = ...,
187 globs: dict[str, Any] | None = ...,
188 extraglobs: dict[str, Any] | None = ...,
189 test_finder: DocTestFinder | None = ...,
191 ) -> _DocTestSuite: ...
193 class DocFileCase(DocTestCase):
194 def id(self) -> str: ...
195 def format_failure(self, err: str) -> str: ...
199 module_relative: bool = ...,
200 package: None | str | types.ModuleType = ...,
201 globs: dict[str, Any] | None = ...,
202 parser: DocTestParser = ...,
203 encoding: str | None = ...,
205 ) -> DocFileCase: ...
206 def DocFileSuite(*paths: str, **kw: Any) -> _DocTestSuite: ...
207 def script_from_examples(s: str) -> str: ...
208 def testsource(module: None | str | types.ModuleType, name: str) -> str: ...
209 def debug_src(src: str, pm: bool = ..., globs: dict[str, Any] | None = ...) -> None: ...
210 def debug_script(src: str, pm: bool = ..., globs: dict[str, Any] | None = ...) -> None: ...
211 def debug(module: None | str | types.ModuleType, name: str, pm: bool = ...) -> None: ...