massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 2and3 / doctest.pyi
1 from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Type, Union\r
2 \r
3 import sys\r
4 import types\r
5 import unittest\r
6 \r
7 TestResults = NamedTuple('TestResults', [\r
8     ('failed', int),\r
9     ('attempted', int),\r
10 ])\r
11 \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
17 ELLIPSIS: int\r
18 SKIP: int\r
19 IGNORE_EXCEPTION_DETAIL: int\r
20 \r
21 COMPARISON_FLAGS: int\r
22 \r
23 REPORT_UDIFF: int\r
24 REPORT_CDIFF: int\r
25 REPORT_NDIFF: int\r
26 REPORT_ONLY_FIRST_FAILURE: int\r
27 if sys.version_info >= (3, 4):\r
28     FAIL_FAST: int\r
29 \r
30 REPORTING_FLAGS: int\r
31 \r
32 BLANKLINE_MARKER: str\r
33 ELLIPSIS_MARKER: str\r
34 \r
35 class Example:\r
36     source: str\r
37     want: str\r
38     exc_msg: Optional[str]\r
39     lineno: int\r
40     indent: int\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
45 \r
46 class DocTest:\r
47     examples: List[Example]\r
48     globs: Dict[str, Any]\r
49     name: str\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
56 \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
61 \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
67 \r
68 _Out = Callable[[str], Any]\r
69 _ExcInfo = Tuple[Type[BaseException], BaseException, types.TracebackType]\r
70 \r
71 class DocTestRunner:\r
72     DIVIDER: str\r
73     optionflags: int\r
74     original_optionflags: int\r
75     tries: int\r
76     failures: int\r
77     test: DocTest\r
78 \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
87 \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
91 \r
92 class DocTestFailure(Exception):\r
93     test: DocTest\r
94     example: Example\r
95     got: str\r
96 \r
97     def __init__(self, test: DocTest, example: Example, got: str) -> None: ...\r
98 \r
99 class UnexpectedException(Exception):\r
100     test: DocTest\r
101     example: Example\r
102     exc_info: _ExcInfo\r
103 \r
104     def __init__(self, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...\r
105 \r
106 class DebugRunner(DocTestRunner): ...\r
107 \r
108 master: Optional[DocTestRunner]\r
109 \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
120 \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
133 \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
139 \r
140 if sys.version_info >= (3, 4):\r
141     class _DocTestSuite(unittest.TestSuite): ...\r
142 else:\r
143     _DocTestSuite = unittest.TestSuite\r
144 \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
148 \r
149 class DocFileCase(DocTestCase):\r
150     def id(self) -> str: ...\r
151     def format_failure(self, err: str) -> str: ...\r
152 \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