1 from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Type, Union
\r
7 TestResults = NamedTuple('TestResults', [
\r
12 OPTIONFLAGS_BY_NAME: Dict[str, int]
\r
13 def register_optionflag(name: str) -> int: ...
\r
14 DONT_ACCEPT_TRUE_FOR_1: int
\r
15 DONT_ACCEPT_BLANKLINE: int
\r
16 NORMALIZE_WHITESPACE: int
\r
19 IGNORE_EXCEPTION_DETAIL: int
\r
21 COMPARISON_FLAGS: int
\r
26 REPORT_ONLY_FIRST_FAILURE: int
\r
27 if sys.version_info >= (3, 4):
\r
30 REPORTING_FLAGS: int
\r
32 BLANKLINE_MARKER: str
\r
33 ELLIPSIS_MARKER: str
\r
38 exc_msg: Optional[str]
\r
41 options: Dict[int, bool]
\r
42 def __init__(self, source: str, want: str, exc_msg: Optional[str] = ..., lineno: int = ..., indent: int = ...,
\r
43 options: Optional[Dict[int, bool]] = ...) -> None: ...
\r
44 def __hash__(self) -> int: ...
\r
47 examples: List[Example]
\r
48 globs: Dict[str, Any]
\r
50 filename: Optional[str]
\r
51 lineno: Optional[int]
\r
52 docstring: Optional[str]
\r
53 def __init__(self, examples: List[Example], globs: Dict[str, Any], name: str, filename: Optional[str], lineno: Optional[int], docstring: Optional[str]) -> None: ...
\r
54 def __hash__(self) -> int: ...
\r
55 def __lt__(self, other: DocTest) -> bool: ...
\r
57 class DocTestParser:
\r
58 def parse(self, string: str, name: str = ...) -> List[Union[str, Example]]: ...
\r
59 def get_doctest(self, string: str, globs: Dict[str, Any], name: str, filename: Optional[str], lineno: Optional[str]) -> DocTest: ...
\r
60 def get_examples(self, strin: str, name: str = ...) -> List[Example]: ...
\r
62 class DocTestFinder:
\r
63 def __init__(self, verbose: bool = ..., parser: DocTestParser = ...,
\r
64 recurse: bool = ..., exclude_empty: bool = ...) -> None: ...
\r
65 def find(self, obj: object, name: Optional[str] = ..., module: Union[None, bool, types.ModuleType] = ...,
\r
66 globs: Optional[Dict[str, Any]] = ..., extraglobs: Optional[Dict[str, Any]] = ...) -> List[DocTest]: ...
\r
68 _Out = Callable[[str], Any]
\r
69 _ExcInfo = Tuple[Type[BaseException], BaseException, types.TracebackType]
\r
71 class DocTestRunner:
\r
74 original_optionflags: int
\r
79 def __init__(self, checker: Optional[OutputChecker] = ..., verbose: Optional[bool] = ..., optionflags: int = ...) -> None: ...
\r
80 def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ...
\r
81 def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
\r
82 def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
\r
83 def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...
\r
84 def run(self, test: DocTest, compileflags: Optional[int] = ..., out: Optional[_Out] = ..., clear_globs: bool = ...) -> TestResults: ...
\r
85 def summarize(self, verbose: Optional[bool] = ...) -> TestResults: ...
\r
86 def merge(self, other: DocTestRunner) -> None: ...
\r
88 class OutputChecker:
\r
89 def check_output(self, want: str, got: str, optionflags: int) -> bool: ...
\r
90 def output_difference(self, example: Example, got: str, optionflags: int) -> str: ...
\r
92 class DocTestFailure(Exception):
\r
97 def __init__(self, test: DocTest, example: Example, got: str) -> None: ...
\r
99 class UnexpectedException(Exception):
\r
104 def __init__(self, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...
\r
106 class DebugRunner(DocTestRunner): ...
\r
108 master: Optional[DocTestRunner]
\r
110 def testmod(m: Optional[types.ModuleType] = ..., name: Optional[str] = ..., globs: Dict[str, Any] = ..., verbose: Optional[bool] = ...,
\r
111 report: bool = ..., optionflags: int = ..., extraglobs: Dict[str, Any] = ...,
\r
112 raise_on_error: bool = ..., exclude_empty: bool = ...) -> TestResults: ...
\r
113 def testfile(filename: str, module_relative: bool = ..., name: Optional[str] = ..., package: Union[None, str, types.ModuleType] = ...,
\r
114 globs: Optional[Dict[str, Any]] = ..., verbose: Optional[bool] = ..., report: bool = ..., optionflags: int = ...,
\r
115 extraglobs: Optional[Dict[str, Any]] = ..., raise_on_error: bool = ..., parser: DocTestParser = ...,
\r
116 encoding: Optional[str] = ...) -> TestResults: ...
\r
117 def run_docstring_examples(f: object, globs: Dict[str, Any], verbose: bool = ..., name: str = ...,
\r
118 compileflags: Optional[int] = ..., optionflags: int = ...) -> None: ...
\r
119 def set_unittest_reportflags(flags: int) -> int: ...
\r
121 class DocTestCase(unittest.TestCase):
\r
122 def __init__(self, test: DocTest, optionflags: int = ..., setUp: Optional[Callable[[DocTest], Any]] = ...,
\r
123 tearDown: Optional[Callable[[DocTest], Any]] = ...,
\r
124 checker: Optional[OutputChecker] = ...) -> None: ...
\r
125 def setUp(self) -> None: ...
\r
126 def tearDown(self) -> None: ...
\r
127 def runTest(self) -> None: ...
\r
128 def format_failure(self, err: str) -> str: ...
\r
129 def debug(self) -> None: ...
\r
130 def id(self) -> str: ...
\r
131 def __hash__(self) -> int: ...
\r
132 def shortDescription(self) -> str: ...
\r
134 class SkipDocTestCase(DocTestCase):
\r
135 def __init__(self, module: types.ModuleType) -> None: ...
\r
136 def setUp(self) -> None: ...
\r
137 def test_skip(self) -> None: ...
\r
138 def shortDescription(self) -> str: ...
\r
140 if sys.version_info >= (3, 4):
\r
141 class _DocTestSuite(unittest.TestSuite): ...
\r
143 _DocTestSuite = unittest.TestSuite
\r
145 def DocTestSuite(module: Union[None, str, types.ModuleType] = ..., globs: Optional[Dict[str, Any]] = ...,
\r
146 extraglobs: Optional[Dict[str, Any]] = ..., test_finder: Optional[DocTestFinder] = ...,
\r
147 **options: Any) -> _DocTestSuite: ...
\r
149 class DocFileCase(DocTestCase):
\r
150 def id(self) -> str: ...
\r
151 def format_failure(self, err: str) -> str: ...
\r
153 def DocFileTest(path: str, module_relative: bool = ..., package: Union[None, str, types.ModuleType] = ...,
\r
154 globs: Optional[Dict[str, Any]] = ..., parser: DocTestParser = ...,
\r
155 encoding: Optional[str] = ..., **options: Any) -> DocFileCase: ...
\r
156 def DocFileSuite(*paths: str, **kw: Any) -> _DocTestSuite: ...
\r
157 def script_from_examples(s: str) -> str: ...
\r
158 def testsource(module: Union[None, str, types.ModuleType], name: str) -> str: ...
\r
159 def debug_src(src: str, pm: bool = ..., globs: Optional[Dict[str, Any]] = ...) -> None: ...
\r
160 def debug_script(src: str, pm: bool = ..., globs: Optional[Dict[str, Any]] = ...) -> None: ...
\r
161 def debug(module: Union[None, str, types.ModuleType], name: str, pm: bool = ...) -> None: ...
\r